Admob 未填充所有宽度

发布于 2024-11-29 12:22:29 字数 352 浏览 2 评论 0原文

我对 admob 横幅尺寸有疑问: 我的测试终端是 Samsung Galaxy s (480x800) 和 Asus eee pad Transformer (800x1200)。 在 admob 文档中,横幅尺寸我使用的手机尺寸为 320x50,平板电脑尺寸为 728x90。

使用 480x800(和纵向)时,添加会展开并填充所有布局,但在横向或平板电脑中,横幅仅占据一部分,其余部分为黑色。

我该如何解决这个问题?

谢谢

I have a problem with the admob banner size:
My test terminals are Samsung Galaxy s (480x800) and Asus eee pad transformer (800x1200).
In the admob doc the banner sizes im using are 320x50 for phones and 728x90 for tablets.

With 480x800 (and portrait) the add is expanded and fill all the layout but in landscape or with the tablet the banner only take a portion and the rest is black.

How can I fix that?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

醉酒的小男人 2024-12-06 12:22:29

您必须在 adView 属性 adSize 中设置标志 SMART_BANNER。像这样:

<com.google.ads.AdView
    android:id="@+id/adView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    ads:adSize="SMART_BANNER"
    ads:adUnitId="@string/admob_id"
    ads:loadAdOnCreate="true"
    ads:testDevices="@string/devices_id" />

You have to set the flag SMART_BANNER in the adView attribute adSize. like that:

<com.google.ads.AdView
    android:id="@+id/adView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    ads:adSize="SMART_BANNER"
    ads:adUnitId="@string/admob_id"
    ads:loadAdOnCreate="true"
    ads:testDevices="@string/devices_id" />
毅然前行 2024-12-06 12:22:29

大多数应用程序都像您的应用程序一样,这不是问题,很难让它在横向模式下填充空间!不用担心

Most of the apps are like yours it is not a problem , it is hard to get it to fill the space in landscape mode !! Don't Worry

只有一腔孤勇 2024-12-06 12:22:29

根据 Google 横幅广告自定义,您可以使用智能横幅

注意:布局中的智能横幅视图必须占用整个宽度
设备的。如果没有,您将收到一条警告消息
“没有足够的空间来显示广告”,并且不会显示横幅。

要使用智能横幅,请为广告尺寸指定常量 SMART_BANNER:

AdView adView = new AdView(this);
adView.setAdSize(AdSize.SMART_BANNER);

智能横幅

As per Google Banner Ad Customization you can use Smart Banners

Note: The smart banner view in your layout must consume the full width
of the device. If it doesn't, you'll get a warning with the message
"Not enough space to show ad", and the banner will not be displayed.

To use Smart Banners, specify the constant SMART_BANNER for the ad size:

AdView adView = new AdView(this);
adView.setAdSize(AdSize.SMART_BANNER);

Smart Banners

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文