Major layout bug for Banners, in new AdMob (part of Google Play Services)

220 views
Skip to first unread message

I.D.E.

unread,
Jul 28, 2014, 4:21:29 PM7/28/14
to google-adm...@googlegroups.com
Hi there,

There is a serious bug in the latest AdMob library (Google Play Services), regarding AdView layouts in XML. If you set android:layout_height="wrap_content" on the AdView, it will just be completely ignored.

This means that an empty/unloaded Ad (for example when there is no Internet connection) will still consume the height space of a loaded ad. The empty ad will leave a big vertical gap, when it's supposed to collapse its height to zero!

It's looks bad, especially when the virtual keyboard appears, with the setting isScrollContainer=true. There will be a big gap just above the keyboard.

The previous version of AdMob (standalone, version 6.4.1) did not do this. It would correctly use a the height of zero until an ad has loaded.

Could Google please restore the behavior of the previous AdMob.

Amy Quispe (AdMob SDK Team)

unread,
Jul 28, 2014, 7:30:09 PM7/28/14
to google-adm...@googlegroups.com
Hi there,

This behavior is intentional so that you don't have to plan around your layout changing. If you're worried about not getting fill, you can try mediating with another network, or using a Custom Event so an image can get shown in the event you don't get an ad.

Amy Quispe

I.D.E.

unread,
Jul 29, 2014, 1:32:46 PM7/29/14
to google-adm...@googlegroups.com
Hi there,

While I understand Google's intentions, this is not really the right way to do it. It benefits people who display a banner ad at the top of the screen, but it messes up layouts that have the ad at the bottom of the screen. Google recommends using either the top or the bottom to show ads.

Another reason is that it violates the Android layout rules for "wrap_content". If a widget is set to "wrap_content" and it has no content to show, it's supposed to collapse its height to zero. But AdMob will just fill it to a pre-defined height and show nothing, and this completely ignores the conventions.

A better approach could be to guide people on how to show a fixed height in an AdMob view, based on the published banner sizes. It's not too difficult. Here is a brief summary:

<com.google.ads.AdView
    android:id="@+id/adView"
    android:layout_width="fill_parent"
    android:layout_height="@dimen/admob_height_dip"
    android:background="@drawable/admob_placeholder_image"
    ads:adUnitId="..."
    ads:adSize="SMART_BANNER"
    ads:loadAdOnCreate="true">
</com.google.ads.AdView>

res/values-mdpi/admob_height.xml :

<resources>
    <!-- https://developers.google.com/mobile-ads-sdk/docs/admob/smart-banners -->
    <dimen name="admob_height_dip">51dip</dimen>
    <!-- Use 50dip + 1dip to prevent it being short by 1 horizontal screen pixel -->
</resources>


res/values-land-mdpi/admob_height.xml :

<resources>
    <!-- https://developers.google.com/mobile-ads-sdk/docs/admob/smart-banners -->
    <dimen name="admob_height_dip">33dip</dimen>
    <!-- Use 32dip + 1dip to prevent it being short by 1 horizontal screen pixel -->
</resources>

And so on...
This could even be a new tutorial page...


I think that the August 1, 2014 deadline should be removed, due to the instability of the new version.

And there are other issues as well, like the 1 MB increase in app size when you link to Google Play Services. This includes about 500 KB of Google+ icons and resources (use Winzip or Zipeg to open the apk file). There's no explanation for why these are included inside the app.
Reply all
Reply to author
Forward
0 new messages