Estilos nativos
Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Selecione a plataforma:
Android
iOS
Flutter
Com as configurações de estilo nativo,
o Google Ad Manager pode gerenciar a renderização dos seus anúncios
nativos com base nos estilos nativos especificados no produto. Primeiro, especifique o tamanho e a segmentação.
Em seguida, adicione HTML, CSS e JavaScript para definir anúncios responsivos
e produzir uma exibição de qualidade em todas as telas. Você não precisa fazer nenhuma
renderização. O Ad Manager aplica automaticamente o estilo nativo
certo ao destino. Os estilos nativos são implementados como anúncios de banner,
usando um AdManagerAdView
. Eles podem ser usados com um tamanho de anúncio fixo
determinado com antecedência ou um tamanho de anúncio flexível determinado no tempo de execução.
Pré-requisitos
- Versão 0.13.6 ou mais recente do plug-in do Flutter dos anúncios para dispositivos móveis do Google.
Este guia presume que você tenha um conhecimento razoável sobre o funcionamento do SDK de anúncios para dispositivos móveis do Google.
Se não for o caso, consulte nosso guia
Como começar.
Tamanho fixo
Os estilos nativos com tamanho fixo permitem controlar a largura e a altura
do anúncio nativo. Para definir um tamanho fixo, siga estas etapas:
Crie um item de linha na interface do Ad Manager e selecione um dos
tamanhos predefinidos no menu suspenso do campo Size
.
Carregue um AdManagerBannerAd
com o mesmo tamanho que você configurou na etapa 1.
Consulte a documentação do anúncio de banner
para saber como instanciar e carregar um anúncio.
Confira uma lista de tamanhos e as constantes AdSize
correspondentes
na seção Tamanho do
banner.
Veja um exemplo de como especificar um tamanho fixo, como o
MEDIUM_RECTANGLE
(300 x 250):
AdManagerBannerAd ad = AdManagerBannerAd(
adUnitId: '<your-ad-unit>',
sizes: <AdSize>[AdSize.mediumRectangle],
request: AdManagerAdRequest(),
);
Tamanho flexível
Em alguns casos, um tamanho fixo pode não fazer sentido. Por exemplo, talvez você
queira que a largura do anúncio corresponda ao conteúdo do app, mas que a altura
seja ajustada dinamicamente para se adequar ao conteúdo do anúncio. Nesse caso,
especifique Fluid
como o tamanho do anúncio na interface do Ad Manager,
designando que o tamanho do anúncio é determinado no tempo de execução no app.
O SDK fornece uma constante AdSize
especial, FLUID
, para lidar com essa situação.
A altura do anúncio responsivo é determinada de maneira dinâmica com base na largura definida pelo publisher.
Assim, a visualização do anúncio na plataforma ajusta a altura para corresponder à do
criativo.
Solicitação flexível
Use FluidAdManagerBannerAd
para solicitar um anúncio flexível:
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();
},
),
Exibição do anúncio flexível
Depois que o anúncio for carregado, use FluidAdWidget
para mostrar anúncios flexíveis. Ele vai
ajustar a altura para corresponder à visualização do anúncio na plataforma:
FluidAdWidget(
width: <your-width>,
ad: fluidAd,
);
Confira uma implementação do tamanho de anúncio flexível do Ad Manager no app de exemplo
no GitHub.
Exceto em caso de indicação contrária, o conteúdo desta página é licenciado de acordo com a Licença de atribuição 4.0 do Creative Commons, e as amostras de código são licenciadas de acordo com a Licença Apache 2.0. Para mais detalhes, consulte as políticas do site do Google Developers. Java é uma marca registrada da Oracle e/ou afiliadas.
Última atualização 2025-09-02 UTC.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Não contém as informações de que eu preciso","missingTheInformationINeed","thumb-down"],["Muito complicado / etapas demais","tooComplicatedTooManySteps","thumb-down"],["Desatualizado","outOfDate","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Problema com as amostras / o código","samplesCodeIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 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)."]]