我想知道要使用FirebaseRecyclerAdapter在recyclerview中实施admob原生广告,如果您能够提前做出答案,请详细解答
答案 0 :(得分:0)
试试这个
public NativeExpressAdView nativeAdview;
public YourViewHolder(View view) {
super(view);
nativeAdview = (NativeExpressAdView) view.findViewById(R.id.nativeAdView);
}
public void loadNativeAd(AdRequest nativeRequest){
if(nativeAdview != null) {
nativeAdview.loadAd(nativeRequest);
nativeAdview.setAdListener(new AdListener() {
@Override
public void onAdLoaded() {
super.onAdLoaded();
nativeAdview.setVisibility(View.VISIBLE);
}
});
}
}
然后从适配器加载:
protected void populateViewHolder(YourViewHolder viewHolder, myModel model, int position) {
//Native Ads
viewHolder.loadNativeAd(nativeRequest);