智能横幅广告
作为一种广告单元,智能横幅可在任何屏幕尺寸、任何屏幕方向的各种设备上展示与屏幕等宽的横幅广告。智能横幅广告可以检测设备处于当前屏幕方向时的宽度,并据此创建与之等宽的广告视图。
智能横幅可实现三种广告高度:
广告高度 |
屏幕高度 |
32 dp |
≤ 400 dp |
50 dp |
> 400 dp 且 ≤ 720 dp |
90 dp |
> 720 dp |
通常情况下,在手机上,当屏幕为纵向时,智能横幅广告高度为 50dp;当屏幕为横向时,广告高度为 32dp。在平板电脑上,不论屏幕方向为纵向还是横向,横幅高度通常均为 90dp。
当图片广告不足以占据所分配的整个空间时,系统会居中放置图片,然后填充两侧剩余的空间。

如需在 XML 中使用智能横幅广告,请为广告尺寸指定常量 SMART_BANNER
,并将 AdView
的宽度设置为 match_parent
。例如:
<com.google.android.gms.ads.admanager.AdManagerAdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
ads:adSize="SMART_BANNER"
ads:adUnitId="ca-app-pub-3940256099942544/6300978111">
</com.google.android.gms.ads.admanager.AdManagerAdView>
如需以编程方式制作智能横幅广告,请将 AdSize.SMART_BANNER
用作广告尺寸:
AdManagerAdView adView = new AdManagerAdView(this);
adView.setAdSizes(AdSize.SMART_BANNER);
val adView = AdManagerAdView(this)
adView.adSizes = AdSize.SMART_BANNER
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-02-25。
[null,null,["最后更新时间 (UTC):2025-02-25。"],[[["Smart Banners are responsive ad units that automatically adjust their size to fit the width of the device screen."],["Smart Banners have three possible ad heights (32dp, 50dp, 90dp) depending on the screen height of the device."],["When using Smart Banners, specify `SMART_BANNER` as the `adSize` and set the `AdView` width to `match_parent`."],["Consider using newer adaptive banners instead of Smart Banners for enhanced functionality."]]],["Smart Banners display screen-width ads, adapting to device size and orientation. They use three ad heights: 32 dp (≤ 400 dp screen height), 50 dp (\u003e 400 dp and ≤ 720 dp), and 90 dp (\u003e 720 dp). To implement in XML, set `adSize` to `SMART_BANNER` and `AdView` width to `match_parent`. Programmatically, utilize `AdSize.SMART_BANNER`. Image ads are centered when smaller than the space. The content suggests using adaptive banners instead.\n"]]