understanding scale of ads

1,847 views
Skip to first unread message

scober

unread,
Nov 17, 2011, 11:46:24 PM11/17/11
to Google AdMob Ads Developers
I am very confused by the size/scale of banners in Android. I have an
app that I am doing using Fkash. The native size is 1024 x 600 and I
have it locked to landscape orientation. If I call an AdMob banner of
size 320x50 and set it to the bottom right of the screen, it seems to
draw fine on my Galaxy Tab 10.1 (1280 x 800 Res.) But on a Motorola
Droid (854 x 480) it is huge and draw using way more screen than it
should. It appears that the banner is scaling to the full width of the
screen I portrait mode. This makes no sense as it seems to assume that
all apps run in portrait. Is there some way to use actual pixels on
the screen instead of some strangely scaled virtual pixels?

Eric Leichtenschlag

unread,
Nov 21, 2011, 1:30:39 PM11/21/11
to google-adm...@googlegroups.com
Scober,

The size that the AdView takes in is specified in density pixels (dp).  This is done so that the ad has density independence, which means developers don't have to worry about different density devices when building their layout.  The actual pixels that the ad consumes can be determined by the following equation: px = dp * (dpi / 160).

It looks like the Galaxy Tab 10.1 has medium density (160 dpi), so the 320x50dp ad will fill 320x50 pixels.  The Motorola Droid seems to have a high density (240 dpi), so the same 320x50dp ad will fill 480x75 pixels on the screen.

Eric, AdMob SDK Support

Scott Berfield

unread,
Nov 22, 2011, 8:46:34 PM11/22/11
to google-adm...@googlegroups.com
That certainly makes it difficult to do bitmap-based layouts - particulalry in landscape. In your example, the banner on the droid in landscape mode would take up more than 56% of the horizontal width and 15.6% of the height of the screen. On the tablet, the same ad takes  31% of the width and 6.5% of the height. Not sure how that keeps the ads at visual parity, but even if I granted that it did, it means considerably less real estate for the application to use on the Droid -- where arguably, you would want as much space as possible to make the app usable.
 
I would be interested to see what other folks have done to adapt to this.

Eric Leichtenschlag

unread,
Nov 22, 2011, 9:08:56 PM11/22/11
to google-adm...@googlegroups.com
I agree that the 320x50 ad size is more natural for portrait mode than it is for landscape.  I'm not sure what the best practice is for banner ads in landscape mode.

As far as visual parity goes, the idea behind density pixels is that it doesn't matter if you have a 240x400, 320x480, or a 480x800 screen on your phone, the ad will take up the same amount of real estate (on low density 240x400 pixel phones, the 320x50dp ad actually translates to 240x37.5 pixels).  The 480x854 has the same density as the 480x800, which means the droid's screen must be just a little taller, but the ad is still the same physical size.  The tablet has a much bigger screen size, so it makes sense that the ad looks smaller.  But since there is more space on tablets, there are more banner sizes to choose from.

Eric, AdMob SDK Support

Scott Berfield

unread,
Nov 23, 2011, 1:53:05 AM11/23/11
to google-adm...@googlegroups.com
Yea - more complex than I expected, but that is what makes this stuff fun :)
 
One thing I am trying to find and haven't turned up is where the lines are between LDPI, MDPI, HDPI, and XHDPI.
 
For example, the tablet is (assuing i am calculating it correctly) 149 DPI -- SQRT(( 1280 * 1280 )+( 800 * 800)) / 10.1"
 
The Droid is 265 DPI -- SQRT(( 854 * 854 )+( 480 * 480 )) / 3.7"
 
So the Droid would be HDPI or XHDPI? And the Tablet would be MDPI or LDPI?
 
Sorry to be dense. This is a very new way to think about things - I come form a world of absolute pixl values and screen positions and am not used to have the system do things without my knowing exactly what they are.
 
Scott

Eric Leichtenschlag

unread,
Nov 23, 2011, 12:55:07 PM11/23/11
to google-adm...@googlegroups.com
I think you're overthinking this.  You can check out a chart of screen size vs. density size here. The Droid has a screen size 480x854, so I assume it is a WVGA854 (480x854), which is a normal screen, and high density (hdpi, which is 240 dpi).  With 240 dpi, and the equation px = dp * dpi/160, 1 px = 1.5 dpi on the Droid, so you're working with a 320x569 dp screen here.

The Galaxy Tab 1280x800 looks like the WXGA (1280x800), which is an Extra Large Screen and it has medium density (mdpi, which is 160 dpi).  On this screen, 1px = 1 dp, so you have a 1280x800 dp screen here.

With the dimensions in dp now, hopefully it is easier to understand how a 320x50 dp ad scales on your screen.

Eric, AdMob SDK Support

Scott Berfield

unread,
Nov 23, 2011, 1:36:54 PM11/23/11
to google-adm...@googlegroups.com
Thanks!
Reply all
Reply to author
Forward
0 new messages