Native styles
Stay organized with collections
Save and categorize content based on your preferences.
Native style settings let
Google Ad Manager handle the rendering of your native ads based on
native styles you specify within the product. First, specify size and targeting.
Then add HTML, CSS, and JavaScript to define ads that are responsive
and produce a quality display across all screens. You don't need to do
any of the rendering; Ad Manager automatically applies the right native style
for the destination. Native styles are implemented just like banner ads. They
are rendered with a fluid ad size determined at runtime, or with a fixed
ad size determined ahead of time.
Prerequisites
Fluid size
You can use the Fluid ad size in the Ad Manager UI to achieve an ad that
dynamically adjusts to fit its content. With this setting, the ad's width will
match your app's content, and its height will adjust at runtime to accommodate
the ad's content. The SDK provides a special AdSize
constant,
FLUID
, to handle this case. The fluid ad size
height is dynamically determined based on the publisher defined width, allowing
the ad view to adjust its height to match that of the creative.
Create a fluid ad request
Create a layout container for the ad view. Set the layout_height
of the ad
container to wrap_content
because its height will be determined by the ad
returned at runtime.
<FrameLayout
android:id="@+id/fluid_ad_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />
Here's what the implementation looks like for making the ad request:
Replace AD_UNIT_ID with your test device ID.
Once you successfully load the ad, add BannerAd.getView()
to the view hierarchy. For more details, see Load an ad.
Fixed size
Native styles with a fixed size allow you to control the width and height
of the native ad. To set a fixed size, follow these steps:
Create a line item in the Ad Manager UI and select one of the
predefined sizes from the Size
field drop-down.
Load a BannerAd
ad with the predefined AdSize
.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-09-09 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-09 UTC."],[],[],null,["[Native style settings](//support.google.com/admanager/answer/6366914) let\nGoogle Ad Manager handle the rendering of your native ads based on\nnative styles 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. They\nare rendered with a fluid ad size determined at runtime, or with a fixed\nad size determined ahead of time.\n\nPrerequisites\n\n- Complete the [Get started guide](/ad-manager/mobile-ads-sdk/android/early-access/nextgen/quick-start).\n\nFluid size\n\nYou can use the Fluid ad size in the Ad Manager UI to achieve an ad that\ndynamically adjusts to fit its content. With this setting, the ad's width will\nmatch your app's content, and its height will adjust at runtime to accommodate\nthe ad's content. The SDK provides a special `AdSize` constant,\n[`FLUID`](/ad-manager/mobile-ads-sdk/android/early-access/nextgen/reference/com/google/android/libraries/ads/mobile/sdk/AdSize#FLUID()), to handle this case. The fluid ad size\nheight is dynamically determined based on the publisher defined width, allowing\nthe ad view to adjust its height to match that of the creative.\n\nCreate a fluid ad request\n\nCreate a layout container for the ad view. Set the `layout_height` of the ad\ncontainer to `wrap_content` because its height will be determined by the ad\nreturned at runtime. \n\n \u003cFrameLayout\n android:id=\"@+id/fluid_ad_container\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"wrap_content\"\n android:layout_gravity=\"center_horizontal\" /\u003e\n\nHere's what the implementation looks like for making the ad request: \n\nKotlin \n\n // Be sure to specify Fluid as the ad size in the Ad Manager UI and create\n // an ad request with FLUID size.\n val adRequest = BannerAdRequest.Builder(\"\u003cvar translate=\"no\"\u003eAD_UNIT_ID\u003c/var\u003e\", AdSize.FLUID).build()\n\nJava \n\n // Be sure to specify Fluid as the ad size in the Ad Manager UI and create\n // an ad request with FLUID size.\n BannerAdRequest adRequest = new BannerAdRequest.Builder(\"\u003cvar translate=\"no\"\u003eAD_UNIT_ID\u003c/var\u003e\", AdSize.FLUID).build();\n\nReplace \u003cvar translate=\"no\"\u003eAD_UNIT_ID\u003c/var\u003e with your test device ID.\n\nOnce you successfully load the ad, add [`BannerAd.getView()`](/ad-manager/mobile-ads-sdk/android/early-access/nextgen/reference/com/google/android/libraries/ads/mobile/sdk/banner/BannerAd#getView(android.app.Activity))\nto the view hierarchy. For more details, see [Load an ad](/ad-manager/mobile-ads-sdk/android/early-access/nextgen/banner#load_an_ad).\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 drop-down.\n\n2. Load a [`BannerAd`](/ad-manager/mobile-ads-sdk/android/early-access/nextgen/reference/com/google/android/libraries/ads/mobile/sdk/banner/BannerAd) ad with the predefined `AdSize`."]]