How to place a banner ad at the bottom of your app.

To place a banner ad at the bottom of your app.

you can update your activity_main.xml layout file like this: 


<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"

    xmlns:ads="http://schemas.android.com/apk/res-auto"

    android:layout_width="match_parent"

    android:layout_height="match_parent">


    <!-- Your other UI components go here -->


    <com.google.android.gms.ads.AdView

        android:id="@+id/adView"

        android:layout_width="wrap_content"

        android:layout_height="wrap_content"

        android:layout_alignParentBottom="true"

        android:layout_centerHorizontal="true"

        ads:adSize="BANNER"

        ads:adUnitId="ca-app-pub-3940256099942544/6300978111"/>

</RelativeLayout>


No comments:

Post a Comment