プログラムに admob を追加したいのですが、常に 1 つではなく 2 つの広告が表示されます。アクティビティの一番上に広告を表示したい。これらの 2 つの広告が上にくっついています。一方を削除するにはどうすればよいですか?
ここにxmlがあります:
<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="@drawable/background"
android:gravity="top"
tools:context=".MainActivity" >
<ImageButton
android:id="@+id/btnSwitch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginTop="25dp"
android:background="@null"
android:contentDescription="@null"
android:src="@drawable/btn_switch_on" />
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/textView2"
android:layout_centerHorizontal="true"
android:text="@string/Develop"
android:textColor="#C0C0C0"
android:textSize="15sp" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:padding="5dp"
android:text="@string/soheilen"
android:textColor="#C0C0C0"
android:textSize="18sp" />
<ImageButton
android:id="@+id/imageButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:background="@null"
android:contentDescription="@null"
android:minHeight="64dp"
android:minWidth="64dp"
android:src="@drawable/more" />
<ToggleButton
android:id="@+id/toggleButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:text="@string/mute"
android:textOff="@string/mute"
android:textOn="@string/mute" />
<LinearLayout
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_width="fill_parent"
android:id="@+id/mainline"
android:gravity="top"
>
<com.google.ads.AdView
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
ads:adSize="BANNER"
ads:adUnitId="aXXXXXXXXXXb"
ads:loadAdOnCreate="true"
android:gravity="top" >
</com.google.ads.AdView>
</LinearLayout>
</RelativeLayout>
ここにメインのJavaの私のコードがあります:
AdView adView = (AdView)this.findViewById(R.id.adView);
AdRequest adRequest = new AdRequest();
adView = new AdView(this, AdSize.BANNER,"xxxxxxxxxxxx");
LinearLayout layout = (LinearLayout) findViewById(R.id.mainline);
layout.addView(adView);
adView.loadAd(adRequest);
相対レイアウトなどの他の設定を試しましたが、正しく機能しません!