我可以在Android布局中添加几个广告横幅?

use*_*687 1 android ads banner admob android-linearlayout

我想在LinearLayout中添加第二个广告横幅,但是插入第二个横幅时我的应用程序崩溃。将外部横幅插入RelativeLayout效果很好,但是我想在ScrollView内添加第二个。我该怎么办?这是我的代码:

 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#000000" > 

<ScrollView
    android:id="@+id/scrollView1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" >

    <LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>

          <TextView

          />

          <ToggleButton

          />

    <com.google.ads.AdView
    android:id="@+id/adView"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"

    ads:adSize="BANNER"
    ads:adUnitId="xxxxxxxx"
    ads:loadAdOnCreate="true"
     >
</com.google.ads.AdView>

 </LinearLayout>
  </ScrollView>

 <com.google.ads.AdView
    android:id="@+id/adView"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    ads:adSize="BANNER"
    ads:adUnitId="xxxxxxxxx"
    ads:loadAdOnCreate="true"
     >
</com.google.ads.AdView>

</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

Wil*_*iam 5

不要在单个页面上显示多个Admob广告视图。这违反了服务条款。您注册了Admob。除非您想暂停自己的Admob帐户。