2

広告を表示しようとしていAdmobますが、これは横向きでのみ機能し、通常モードでは機能しません。

layout-land/main.xmllayout/main.xml同じです!(まあ、バグを見つけるために他のすべてを削除したためです)

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:myapp="http://schemas.android.com/apk/res/test.testpkg"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/background"
    android:padding = "10dip" >

        <com.admob.android.ads.AdView
            android:id="@+id/ad" 
            android:layout_width="fill_parent" 
            android:layout_height="fill_parent"
            myapp:backgroundColor="#000000"
            myapp:primaryTextColor="#FFFFFF"
            myapp:secondaryTextColor="#CCCCCC" />

</RelativeLayout>
4

1 に答える 1

3

相対レイアウトからパディングを削除します。先祖のビューがパディングされていると、AdMob が適切に動作しません。

 <RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:myapp="http://schemas.android.com/apk/res/test.testpkg"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/background"
    >


 <com.admob.android.ads.AdView
 android:id="@+id/ad" 
 android:layout_width="fill_parent" 
 android:layout_height="fill_parent"
 myapp:backgroundColor="#000000"
 myapp:primaryTextColor="#FFFFFF"
 myapp:secondaryTextColor="#CCCCCC"
   />
</RelativeLayout>
于 2010-11-26T02:08:27.800 に答える