开发者

Admob not filling all the width

I have a problem with the admob banner size: My test terminals are Samsung Galaxy s (480x800) and Asus eee pad transformer (800x1200). In the admob doc the banner sizes im using are 320x50 for phones and 728x90 for tablets.

With 480x800 (and 开发者_JAVA百科portrait) the add is expanded and fill all the layout but in landscape or with the tablet the banner only take a portion and the rest is black.

How can I fix that?

Thanks


You have to set the flag SMART_BANNER in the adView attribute adSize. like that:

<com.google.ads.AdView
    android:id="@+id/adView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    ads:adSize="SMART_BANNER"
    ads:adUnitId="@string/admob_id"
    ads:loadAdOnCreate="true"
    ads:testDevices="@string/devices_id" />


Most of the apps are like yours it is not a problem , it is hard to get it to fill the space in landscape mode !! Don't Worry


As per Google Banner Ad Customization you can use Smart Banners

Note: The smart banner view in your layout must consume the full width of the device. If it doesn't, you'll get a warning with the message "Not enough space to show ad", and the banner will not be displayed.

To use Smart Banners, specify the constant SMART_BANNER for the ad size:

AdView adView = new AdView(this);
adView.setAdSize(AdSize.SMART_BANNER);

Admob not filling all the width

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜