0

When i put admob banner ads code in Mainactivity.xml then negivation menu is not working and also covered background content? Testing banner ads is working but negivation menu is not working.... How can i fix this issue.

Here is my Mainactivity.xml code

<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
 <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        tools:context="com.governmentjobonline.MainActivity">

   <include
                android:id="@+id/toolbar"
                layout="@layout/toolbar_layout" />
            <include layout="@layout/tab_layout" />
    </LinearLayout>

    <com.google.android.material.navigation.NavigationView
        android:id="@+id/navigation_view"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:fitsSystemWindows="true"
        app:headerLayout="@layout/drawer_header"
        app:itemTextAppearance="?android:attr/textAppearanceMedium"
        app:menu="@menu/navigation_drawer">
    </com.google.android.material.navigation.NavigationView>

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context=".MainActivity">

        <!-- set Banner ad position in UI layout design -->
        <com.google.android.gms.ads.AdView
            xmlns:ads="http://schemas.android.com/apk/res-auto"
            android:id="@+id/adView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_centerHorizontal="true"
            ads:adSize="FULL_BANNER"
            ads:adUnitId="@string/admob_banner_id">
        </com.google.android.gms.ads.AdView>
  </RelativeLayout>
</androidx.drawerlayout.widget.DrawerLayout>
Stefano Sansone
  • 2,377
  • 7
  • 20
  • 39

1 Answers1

0

This is actually violating AdMob guidelines, Ad overlapping with app content (against policy)

So the correct way to do this is placing your banner ad elsewhere.

user16930239
  • 6,319
  • 2
  • 9
  • 33