Not enough space to show ads! when working in TabActivity

I am trying to use the recently released Google admob SDK (GoogleAdMobAdsSdkAndroid-4.0.4).

Following:

LinearLayout layout = (LinearLayout)findViewById(R.id.my_layout); AdView adView = new AdView(this, AdSize.BANNER,"my_publisher_id"); layout.addView(adView); AdRequest request = new AdRequest(); request.setTesting(true); adView.loadAd(request); 

works great in Activity. However, when I turn on Activity in TabActivity, AdView stops working and says:

WARN / Advertisements (17559): not enough space to display ads! Wants: <480, 75>, has: <448, 495>

Any idea how to enable AdView in TabActivity? Not necessarily in every Activity, I would be happy with AdView only on the top of the tab, but this also does not work.

Many tia

+4
source share
2 answers

The problem was filling LinearLyout, which is inside Tabhost. The gasket is removed and the problem is resolved.

+12
source

The problem was the default padding from the main action

 android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" 

Remove this add-on and it will be resolved :)

+1
source

Source: https://habr.com/ru/post/1346054/


All Articles