Smart banners requesting the wrong width in activities with Dialog theme.

39 views
Skip to first unread message

Mattia Roccaforte

unread,
Nov 29, 2014, 1:00:32 PM11/29/14
to google-adm...@googlegroups.com
I'm using the Theme.AppCompat.Light.DialogWhenLarge in my activity, and I set up an adView via xml with adSize="SMART_BANNER". In small screens, the behavior of the smart banner works fine as expected, but when in large screens the activity switches to the dialog theme, the adview still calculates its width on the screen width, not the activity window's width, resulting in the banner not being shown because the space available is less than the size requested, as proved by logcat messages.
Actually I worked this out by putting a copy of the activity's layout in layout/large and switching to adSize="FULL_BANNER" in this layout: the banner has fixed width and fills in the dialog.
Yet, I'm wondering if smart banner's behavior can't be modified so that it requests its size based on activity's width, instead of screen width. I tried with AdView.setAdSize() but this throws an excpetion saying that the size can be set only once.

Andrew Brogdon (Mobile Ads SDK Team)

unread,
Dec 2, 2014, 2:36:14 PM12/2/14
to google-adm...@googlegroups.com
At the current time, smart banners are designed to take their width from the full device capability, which makes them unsuited for use in fragments and (as you've noted) certain other layouts.  We don't currently have plans to change this, though I'll make sure the engineers hear about your particular situation and concern.

Thanks!

-Andrew
Reply all
Reply to author
Forward
0 new messages