gpt4 book ai didi

java - onCreateViewHolder 与 android.support.v7 中的 onCreateViewHolder 冲突

转载 作者:行者123 更新时间:2023-11-29 23:15:30 26 4
gpt4 key购买 nike

<分区>

我正在尝试在 RecyclerView 项目之间实现 admob 广告。我用以前的应用程序做到了并且工作正常,在这个应用程序中我得到了这个错误 http://prntscr.com/n5es3k

我试过使用:

public class ItemCatgorySubListAdapter extends RecyclerView.Adapter<CustomViewHolder> rather than public class ItemCatgorySubListAdapter extends RecyclerView.Adapter<ItemCatgorySubListAdapter.CustomViewHolder> 

对我没用

public class ItemCatgorySubListAdapter extends RecyclerView.Adapter<ItemCatgorySubListAdapter.CustomViewHolder> {

SettingsMain settingsMain;
private ArrayList<catSubCatlistModel> list;
private CatSubCatOnclicklinstener oNItemClickListener;
private Context mContext;
private static final int DEFAULT_VIEW_TYPE = 1;
private static final int NATIVE_AD_VIEW_TYPE = 2;
public ItemCatgorySubListAdapter(Context context, ArrayList<catSubCatlistModel> feedItemList) {
this.list = feedItemList;
this.mContext = context;
settingsMain = new SettingsMain(context);
}


@Override
public int getItemViewType(int position) {
// Change the position of the ad displayed here. Current is after 5
if ((position + 1) % 3 == 0) {
return NATIVE_AD_VIEW_TYPE;
}
return DEFAULT_VIEW_TYPE;
}

@Override
public RecyclerView.ViewHolder onCreateViewHolder (ViewGroup viewGroup, int i) {
View view;

switch (i) {
default:
view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_cat_sub_cat, null);
return new CustomViewHolder(view);

case NATIVE_AD_VIEW_TYPE:
view = LayoutInflater.from(viewGroup.getContext())
.inflate(R.layout.list_item_native_ad1, viewGroup, false);
return new ViewHolderAdMob(view);

}
}




@Override
public void onBindViewHolder(CustomViewHolder holder, final int position) {

final catSubCatlistModel feedItem = list.get(position);

holder.titleTextView.setText(list.get(position).getCardName());
holder.pathTV.setText(list.get(position).getPath());
holder.priceTV.setText(list.get(position).getPrice());
holder.locationTV.setText(list.get(position).getLocation());
if (feedItem.isIs_show_countDown()) {
holder.cv_countdownView.setVisibility(View.VISIBLE);
holder.cv_countdownView.start(AdsTimerConvert.adforest_bidTimer(feedItem.getTimer_array()));
}

一切正常,唯一的问题是我之前说过的http://prntscr.com/n5es3k

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com