3

I tried to add admob in my preference activity, but after days of digging, the "not enough space" problem is still here. I followed one of the example I can found "Ad in preference activity "Not enough space to show ad! Wants: <480, 75>, Has: <432, 1073741823>"

Then i think it might be because of the auto padding of preference screen. Admob seems to want to take the full width of the screen, so can anyone show me how to override the preference screen width and give the admob the full width ? Thank you!!

Community
  • 1
  • 1
Tony Tong
  • 365
  • 7
  • 15

2 Answers2

1

If you let Eclipse build the activity for you then it puts the following in:

android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"

Delete this or change the dimensions to 0

easycheese
  • 5,859
  • 10
  • 53
  • 87
0

You have to override oncreateview() and setpadding of parent/container to 0, see this link:

Android: How to maximize PreferenceFragment width (or get rid of margin)?

If it is standard activity, try to use XML to figure out visually, width of your adview. It need to be full width of your phone, without padding and or margin from parent container.

Community
  • 1
  • 1
Superbiji
  • 1,723
  • 2
  • 14
  • 21