开发者

Not enough space to show ad! when running within a TabActivity

I'm trying to use the newly released Google admob SDK (GoogleAdMobAdsSdkAndroid-4.0.4).

The 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);

is working just fine in an Activit开发者_JAVA技巧y. However, when I include the above Activity within a TabActivity, AdView stops working and says:

WARN/Ads(17559): Not enough space to show ad! Wants: <480, 75>, Has: <448, 495>

Any idea how can I include AdView within a TabActivity? Not necessarily within each Activity, I'd be happy with the AdView just on top of the Tabs, but that is not working neither.

Many TIA


The problem was in the padding on the LinearLyout that is within the Tabhost. Removed padding and problem solved.


The problem was the default padding from the main activity

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

Remove this padding and it is solved :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜