Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the size, in pixels, of AdSize.BANNER?

In my Android app, I have an AdView:

AdView adView = new AdView(this, AdSize.BANNER, MY_BANNER_UNIT_ID);

How do I get the size of this in pixels?

like image 890
BenH Avatar asked Jan 22 '12 05:01

BenH


1 Answers

As mentioned in the answer by Flynn, an adView is 320 dp by 50 dp. To convert 50 dp to pixels, do

(int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 50, getResources().getDisplayMetrics());

(and similarly for 320 dp).

like image 121
BenH Avatar answered Oct 05 '22 08:10

BenH