AdMob SMART_BANNER is not working in landscape mode

I am using SMART_BANNER in an android project. It works correctly in portrait mode, but when you change the orientation (in landscape orientation), the banner width remains the same. This is my ad layout:

<LinearLayout
        android:id="@+id/adLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:background="#000000"
        android:orientation="vertical" >

        <com.google.android.gms.ads.AdView
            android:id="@+id/adView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            ads:adSize="SMART_BANNER"
            app.backgroundColor ="#000000"
            ads:adUnitId="xxxxxxx"
            android:gravity="center" >
        </com.google.android.gms.ads.AdView>
</LinearLayout>

I also tried android:layout_width="wrap_content"for LinearLayout, which contains a banner and android:layout_width="match_parent"for AdView - nothing happens.

+4
source share
3 answers

Make sure there is no line in maniefest as shown below.

android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
0
source

Yes, smart_banner does not work in landscape mode. So change it

ads: adSize = "Banner"

0
source

, AdView , .

In this case, you must override onConfigurationChangedto track orientation changes and recreate the AdView if the orientation changes. This question seems to have an example, but I have not tried it myself.

In general, SMART_BANNER seems to have a pretty low fill rate in landscape mode.

0
source

All Articles