【发布时间】:2020-01-04 11:04:47
【问题描述】:
我收到了一封邮件,内容是关于修改后的广告代码:调整广告框架的大小
第一个广告
<com.google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
ads:adSize="SMART_BANNER"
ads:adUnitId="ca-app-pub-xxxxxxxxxxxxxxxx">
</com.google.android.gms.ads.AdView>
第二个广告
<com.google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/adViewQuestions"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
ads:adSize="BANNER"
ads:adUnitId="ca-app-pub-xxxxxxxxxxxxx">
</com.google.android.gms.ads.AdView>
第三个广告
<com.google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/adViewBookmarks"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
ads:adSize="BANNER"
ads:adUnitId="ca-app-pub-xxxxxxxxxxxxxx">
</com.google.android.gms.ads.AdView>
第四个广告
<com.google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/adViewProgram"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
ads:adSize="BANNER"
ads:adUnitId="ca-app-pub-xxxxxxxxxxxxx">
</com.google.android.gms.ads.AdView>
第 5 个广告
<com.google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
ads:adSize="SMART_BANNER"
ads:adUnitId="ca-app-pub-xxxxxxxxxxxxxxx">
</com.google.android.gms.ads.AdView>
第 6 个广告
<com.google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
ads:adSize="SMART_BANNER"
ads:adUnitId="ca-app-pub-xxxxxxxxxxxxxxxxxxx">
</com.google.android.gms.ads.AdView>
7th ad
<com.google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/adView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
ads:adSize="BANNER"
ads:adUnitId="ca-app-pub-xxxxxxxxxxxxxxxxxxx">
</com.google.android.gms.ads.AdView>
使用的代码 AdView adView = (AdView) findViewById(R.id.adView); AdRequest adRequest = new AdRequest.Builder().setRequestAgent("android_studio:ad_template").build(); adView.loadAd(adRequest); 这就是我使用的方式...有人可以帮我解决什么问题。
我有一个 webview 可以显示我的静态 HTML,我正在上面展示广告,但我认为它不会违反政策
【问题讨论】:
-
首先需要发布整个 xml 布局,以便可以检查,但根据我的观点,layout_weight 属性横幅可能会隐藏在视图中,所以我建议删除重量或提供足够的重量因此,当显示大尺寸横幅时,您的视图保持不变
标签: admob adsense banner-ads