開始使用
原生廣告是向使用者呈現平台原生 UI 元件的廣告素材資源。在程式碼用語中,這表示當原生廣告載入時,應用程式會收到包含素材資源的 NativeAd
物件,然後由應用程式 (而非 Google Mobile Ads SDK) 負責顯示素材資源。
如要進一步控管廣告樣式,請使用此廣告格式。如果您不需要這些功能,請改用其他廣告格式。
在 Flutter 應用程式中顯示原生廣告的方式有兩種:
- 原生範本:使用 Dart API 設定樣式的預先定義原生範本。
- 平台設定:使用 Android 和 iOS 版面配置工具定義的平台專屬版面配置。
原生範本
您可以選擇兩種範本類型:小型或中型。每個範本都提供 UI 樣式選項,但提供的自訂功能比平台設定實作功能少。
小 |
 Android
|
 iOS
|
中 |
 Android
|
 iOS
|
如要瞭解 Dart 中的原生範本實作詳細資訊,請參閱「原生範本」。
如果您需要完全控制 Android 和 iOS 平台上的廣告外觀和風格,則平台設定會是較佳做法,但您必須為這兩個平台撰寫程式碼。
如需特定平台的設定操作說明,請參閱「平台設定」。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-03-01 (世界標準時間)。
[null,null,["上次更新時間:2025-03-01 (世界標準時間)。"],[[["Native ads give you control over the ad's look and feel by providing ad assets that your app displays using its own UI components."],["You can implement native ads using pre-defined templates with styling options or with platform-specific custom layouts for maximum control."],["Native templates offer small and medium size options with some styling flexibility while platform setup requires Android and iOS code for full customization."]]],[]]