Admob Ads in RecyclerView

I want my own ads to be added to Active Directory that have recyclerview. I am learning android programming and trying to find a tutorial for native ads, but there is no good tutorial for embedding admob's built-in banner in recyclerview. Has anyone tried, please give me some suggestion. Thanks

+4
source share
2 answers

I added my own ad for recyclerview as a footerview in my application.

To do this, you need to learn how to use viewtype in recyclerview.

Google firebase,

+2

NativeExpressAdView

<RelativeLayout
    android:layout_height="wrap_content"
    android:layout_width="match_parent"
 tools:context="com.google.example.gms.ads.nativeexpressexample.MainActivity">

    <TextView
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:text="Hello World!" />

    <com.google.android.gms.ads.NativeExpressAdView
        ads:adSize="320x150"
        ads:adUnitId="@string/ad_unit_id"
        android:id="@+id/adView"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"></com.google.android.gms.ads.NativeExpressAdView>
</RelativeLayout>

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        NativeExpressAdView adView = (NativeExpressAdView) findViewById(R.id.adView);
        adView.loadAd(new AdRequest.Builder().build());
    }
}
+1

All Articles