智慧型橫幅廣告
智慧型橫幅廣告是廣告單元,可在任何螢幕大小的裝置上,以任一方向顯示全螢幕橫幅廣告。智慧型橫幅廣告會偵測裝置在目前方向下的寬度,並建立該大小的廣告檢視畫面。
智慧型橫幅廣告支援三種廣告高度:
廣告高度 |
螢幕高度 |
32 dp |
高度 ≤ 400 dp |
50 dp |
> 400 dp 和 ≤ 720 dp |
90 dp |
> 720 dp |
一般來說,手機上的智慧橫幅廣告在直向模式下的高度為 50 dp,在橫向模式下的高度為 32 dp。在平板電腦上,無論螢幕是縱向或橫向,高度通常為 90 dp。
如果圖片廣告的大小不足以佔據整個分配的空間,圖片會置中,兩側的空間則會填滿。

如要在 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
做為廣告尺寸:
Java
AdManagerAdView adView = new AdManagerAdView(this);
adView.setAdSizes(AdSize.SMART_BANNER);
Kotlin
val adView = AdManagerAdView(this)
adView.adSizes = AdSize.SMART_BANNER
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-02-25 (世界標準時間)。
[null,null,["上次更新時間: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"]]