ネイティブ スタイル
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
ネイティブ スタイルの設定を使用すると、Google アド マネージャーで指定したネイティブ スタイルに基づいてネイティブ広告のレンダリングが処理されます。まず、サイズとターゲティングを指定します。そのうえで、HTML、CSS、JavaScript を追加して、あらゆる画面で適切に表示されるレスポンシブな広告を定義します。アド マネージャーでは、レンダリングの処理を行わなくても、配信先に適したネイティブ スタイルが自動的に適用されます。ネイティブ スタイルは、バナー広告と同じように AdManagerAdView
を使用して実装します。事前に決定される固定の広告サイズか、実行時に決定される Fluid 広告サイズのネイティブ スタイルを使用できます。
前提条件
- Google Mobile Ads Flutter プラグイン バージョン 0.13.6 以降
このガイドは、Google Mobile Ads SDK に関する実践的な知識がある方を対象としています。そうでない場合は、事前にスタートガイドをご確認いただくことをおすすめします。
固定サイズ
固定サイズのネイティブ スタイルを使用すると、ネイティブ広告の幅と高さを制御できます。固定サイズを設定する手順は次のとおりです。
アド マネージャーの管理画面で広告申込情報を作成し、Size
フィールドのプルダウンから定義済みサイズのいずれかを選択します。
ステップ 1 で設定したサイズで AdManagerBannerAd
を読み込みます。広告をインスタンス化して読み込む方法については、バナー広告に関するドキュメントをご覧ください。サイズおよび対応する AdSize
定数のリストについては、バナーサイズのセクションをご覧ください。
MEDIUM_RECTANGLE
(300x250)広告サイズなどの固定サイズを指定する方法の例を次に示します。
AdManagerBannerAd ad = AdManagerBannerAd(
adUnitId: '<your-ad-unit>',
sizes: <AdSize>[AdSize.mediumRectangle],
request: AdManagerAdRequest(),
);
Fluid サイズ
場合によっては、固定サイズが適さないことがあります。たとえば、広告の幅はアプリのコンテンツと同じサイズにして、高さは広告のコンテンツに合わせて動的に調整する場合などです。このようなケースに対処するには、アド マネージャーの管理画面で広告サイズとして Fluid
を指定し、アプリの実行時に広告のサイズが決定されるようにします。SDK には、このケースを処理するための特別な AdSize
定数である FLUID
が用意されています。
Fluid 広告サイズの高さは、パブリッシャーが定義した幅に基づいて動的に決定されるため、プラットフォームの広告ビューの高さはクリエイティブの高さに合わせて調整されます。
Fluid リクエスト
Fluid 広告をリクエストするには、FluidAdManagerBannerAd
を使用します。
final fluidAd = FluidAdManagerBannerAd(
adUnitId: '<your-ad-unit>',
request: AdManagerAdRequest(),
listener: AdManagerBannerAdListener(
onAdLoaded: (Ad ad) {
print('$_fluidAd loaded.');
},
onAdFailedToLoad: (Ad ad, LoadAdError error) {
print('$_fluidAd failedToLoad: $error');
ad.dispose();
},
),
Fluid 広告を表示する
広告が読み込まれたら、FluidAdWidget
を使用して Fluid 広告を表示します。高さは、基盤となるプラットフォームの広告ビューに合わせて調整されます。
FluidAdWidget(
width: <your-width>,
ad: fluidAd,
);
アド マネージャーの Fluid 広告サイズの実装例については、GitHub のサンプルアプリをご覧ください。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-09-02 UTC。
[null,null,["最終更新日 2025-09-02 UTC。"],[[["\u003cp\u003eNative style settings in Google Ad Manager allow you to customize the look and feel of your native ads using HTML, CSS, and JavaScript for a seamless user experience.\u003c/p\u003e\n"],["\u003cp\u003eYou can define fixed-size native ads by specifying their dimensions in the Ad Manager UI and using corresponding \u003ccode\u003eAdSize\u003c/code\u003e constants when loading the ad in your app.\u003c/p\u003e\n"],["\u003cp\u003eAlternatively, fluid-size native ads dynamically adjust their height based on the width you provide, ensuring responsiveness across different screens using the \u003ccode\u003eFluidAdManagerBannerAd\u003c/code\u003e and \u003ccode\u003eFluidAdWidget\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eTo implement native ads, you need Google Mobile Ads Flutter Plugin version 0.13.6 or higher and basic familiarity with the Google Mobile Ads SDK.\u003c/p\u003e\n"]]],["Google Ad Manager renders native ads based on specified styles. Users define ad size and targeting, then add HTML, CSS, and JavaScript for responsive design. Fixed ad sizes are set in the Ad Manager UI and loaded using `AdManagerBannerAd` with corresponding `AdSize` constants. Fluid ads use `Fluid` in the UI and the `FLUID` constant, with `FluidAdManagerBannerAd` for requests and `FluidAdWidget` for display, dynamically adjusting the height.\n"],null,["Select platform: [Android](/ad-manager/mobile-ads-sdk/android/native/styles \"View this page for the Android platform docs.\") [iOS](/ad-manager/mobile-ads-sdk/ios/native/styles \"View this page for the iOS platform docs.\") [Flutter](/ad-manager/mobile-ads-sdk/flutter/native/styles \"View this page for the Flutter platform docs.\")\n\n\u003cbr /\u003e\n\n[Native style settings](//support.google.com/admanager/answer/6366914)\nenable Google Ad Manager to handle the rendering of your native ads based on native\nstyles you specify within the product. First, specify size and targeting.\nThen add HTML, CSS, and JavaScript to define ads that are responsive\nand produce a quality display across all screens. You don't need to do\nany of the rendering; Ad Manager automatically applies the right native style\nfor the destination. Native styles are implemented just like banner ads,\nusing a `AdManagerAdView`. They can be used with a fixed ad\nsize determined ahead of time, or a fluid ad size determined at runtime.\n\nPrerequisites\n\n- Google Mobile Ads Flutter Plugin version 0.13.6 or higher\n\nThis guide assumes some working knowledge of the Google Mobile Ads SDK.\nIf you haven't already done so, consider running through our\n[Get Started](/ad-manager/mobile-ads-sdk/flutter/quick-start) guide.\n\nFixed size\n\nNative styles with a fixed size allow you to control the width and height\nof the native ad. To set a fixed size, follow these steps:\n\n1. Create a line item in the Ad Manager UI and select one of the\n predefined sizes from the `Size` field dropdown.\n\n2. Load an `AdManagerBannerAd` with the same size you set up in step 1.\n See the [Banner Ad](/ad-manager/mobile-ads-sdk/flutter/banner/get-started#instantiate_ad)\n documentation for how to instantiate and load an ad.\n You can see a list of sizes and their corresponding `AdSize` constants\n in the [Banner size](/ad-manager/mobile-ads-sdk/flutter/banner/get-started#banner_sizes)\n section.\n\nHere's an example of how to specify a fixed size, such as the\n`MEDIUM_RECTANGLE` (300x250) ad size: \n\n AdManagerBannerAd ad = AdManagerBannerAd(\n adUnitId: '\u003cyour-ad-unit\u003e',\n sizes: \u003cAdSize\u003e[AdSize.mediumRectangle],\n request: AdManagerAdRequest(),\n );\n\nFluid size\n\nIn some cases, a fixed size may not make sense. For example, you may\nwant the width of the ad to match your app's content, but need its height\nto dynamically adjust to fit the ad's content. To handle this case,\nyou can specify `Fluid` as the ad size in the Ad Manager UI, which\ndesignates that the size of the ad is determined at runtime in the app.\nThe SDK provides a special `AdSize` constant, `FLUID`, to handle this case.\nThe fluid ad size height is dynamically determined based on the publisher\ndefined width, allowing the platform ad view to adjust its height to match that\nof the creative.\n\nFluid request\n\nUse `FluidAdManagerBannerAd` to request a fluid ad: \n\n final fluidAd = FluidAdManagerBannerAd(\n adUnitId: '\u003cyour-ad-unit\u003e',\n request: AdManagerAdRequest(),\n listener: AdManagerBannerAdListener(\n onAdLoaded: (Ad ad) {\n print('$_fluidAd loaded.');\n },\n onAdFailedToLoad: (Ad ad, LoadAdError error) {\n print('$_fluidAd failedToLoad: $error');\n ad.dispose();\n },\n ),\n\nDisplaying the fluid ad\n\nAfter your ad is loaded, use `FluidAdWidget` to display fluid ads. It will\nadjust its height to match the underlying platform ad view: \n\n FluidAdWidget(\n width: \u003cyour-width\u003e,\n ad: fluidAd,\n );\n\nSee an example implementation of Ad Manager Fluid ad size in the example app\non [Github](https://github.com/googleads/googleads-mobile-flutter/blob/master/packages/google_mobile_ads/example/lib/fluid_example.dart)."]]