Admob does not fill the entire 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 admob doc, banner sizes im are used 320x50 for phones and 728x90 for tablets.

With a resolution of 480x800 (and portrait), the extension expands and fills all layouts, but in landscape or with a tablet, only the banner accepts part, and the rest is black.

How can i fix this?

thanks

+6
source share
3 answers

You must set the SMART_BANNER flag in the adView adSize attribute. eg:

 <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" /> 
+11
source

Most applications are similar to yours, this is not a problem, it is difficult to get it to fill the space in landscape mode! Do not worry

0
source

According to Google Banner Customization, you can use Smart Banners

Note. The smart banner view in the layout should use the full width of the device. If this is not the case, you will receive a warning with the message "There is not enough space to display ads" and the banner will not be displayed.

To use smart banners, specify a permanent SMART_BANNER for the ad size:

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

Smart banners

0
source

Source: https://habr.com/ru/post/895062/


All Articles