0

当我将 admob 横幅广告代码放入 Mainactivity.xml 时,negivation 菜单不起作用并且还覆盖了背景内容?测试横幅广告正在工作,但 negivation 菜单不起作用.... 我该如何解决这个问题。

这是我的 Mainactivity.xml 代码

<?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>
4

1 回答 1

0

这实际上违反了 AdMob 指南,广告与应用内容重叠(违反政策)

因此,正确的做法是将横幅广告放在其他地方。

于 2021-11-05T00:22:16.900 回答