智慧型橫幅廣告
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
智慧型橫幅廣告是廣告單元,可在任何螢幕大小的裝置上,以任一方向顯示全螢幕橫幅廣告。智慧型橫幅廣告會偵測裝置在目前方向下的寬度,並建立該大小的廣告檢視畫面。
智慧型橫幅廣告支援三種廣告高度:
廣告高度 |
螢幕高度 |
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.AdView
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.AdView>
如要透過程式輔助方式建立智慧橫幅廣告,請使用 AdSize.SMART_BANNER
做為廣告尺寸:
Java
AdView adView = new AdView(this);
adView.setAdSize(AdSize.SMART_BANNER);
Kotlin
val adView = AdView(this)
adView.adSize = AdSize.SMART_BANNER
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-02-20 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-02-20 (世界標準時間)。"],[[["Smart Banners are responsive ad units that adjust their size to fit the width of the device screen across various devices and orientations."],["They automatically determine the appropriate ad height (32 dp, 50 dp, or 90 dp) based on the screen height of the device."],["It is recommended to use the newer adaptive banners for better performance and user experience."],["Smart Banners can be easily implemented in XML by setting the `adSize` to `SMART_BANNER` and the `AdView` width to `match_parent`, or programmatically by using `AdSize.SMART_BANNER`."]]],[]]