踏出第一步
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
原生廣告是利用平台原生 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-08-31 (世界標準時間)。
[null,null,["上次更新時間:2025-08-31 (世界標準時間)。"],[[["\u003cp\u003eNative ads give you control over the ad's look and feel by providing ad assets that your app displays using native UI components.\u003c/p\u003e\n"],["\u003cp\u003eChoose between Native Templates for pre-defined layouts with styling options or Platform Setup for complete customization using Android/iOS tools.\u003c/p\u003e\n"],["\u003cp\u003eNative Templates offer small and medium sizes with some UI customization, while Platform Setup provides full control but requires platform-specific code.\u003c/p\u003e\n"],["\u003cp\u003eRefer to the provided links for detailed implementation instructions on both Native Templates and Platform Setup for Flutter.\u003c/p\u003e\n"]]],["Native ads allow apps to display ad assets using native UI components. Apps receive a `NativeAd` object and handle asset display. There are two implementation methods: native templates and platform setup. Native templates offer pre-defined small or medium designs with some styling options. Platform setup provides full control over ad appearance on Android and iOS but requires platform-specific code. Native templates are detailed in the linked section and so are the platform specific set up.\n"],null,["Select platform: [Android](/admob/android/native \"View this page for the Android platform docs.\") [iOS](/admob/ios/native \"View this page for the iOS platform docs.\") [Flutter](/admob/flutter/native \"View this page for the Flutter platform docs.\") [Unity](/admob/unity/native-overlay \"View this page for the Unity platform docs.\")\n\n\u003cbr /\u003e\n\nNative ads are ad assets presented to users with UI components native to the\nplatform. In coding terms, this means that when a native ad loads, your app\nreceives a `NativeAd` object that contains its assets, and your app---rather\nthan the Google Mobile Ads SDK---is then responsible for displaying them.\n\nThis ad format is for when you want more control to style the look of your ads.\nIf you don't need these features, use one of our other ad formats.\n\nThere are two ways to display native ads in your Flutter app:\n\n- **Native templates:** Pre-defined native templates styled with a Dart API.\n- **Platform setup:** Custom platform-specific layouts defined using Android and iOS layout tools.\n\nNative templates\n\nThere are two template types to choose from: small or medium. Each template\ncomes with UI styling options; however, they offer less customization than\nthe platform setup implementation.\n\n| Small |\n|-------------|---------|\n| **Android** | **iOS** |\n| **Android** | **iOS** |\n\nFor native templates implementation details in Dart, see [Native\ntemplates](/admob/flutter/native/templates).\n\nPlatform setup\n\nPlatform setup is better when you need complete control of the look and feel for\nyour ads on both Android and iOS platforms, but you'll need to write code for\nboth.\n\nFor platform-specific setup instructions, see [Platform\nsetup](/admob/flutter/native/platforms)."]]