سبک های بومی
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
پلتفرم را انتخاب کنید: Android iOS Flutter تنظیمات سبک بومی Google Ad Manager را قادر میسازد تا رندر تبلیغات بومی شما را بر اساس سبکهای بومی که در محصول مشخص میکنید انجام دهد. ابتدا اندازه و هدف را مشخص کنید. سپس HTML، CSS و جاوا اسکریپت را اضافه کنید تا تبلیغاتی را تعریف کنید که واکنشگرا هستند و نمایش با کیفیتی را در تمام صفحه ها ایجاد کنند. شما نیازی به انجام هیچ یک از رندر ندارید. Ad Manager به طور خودکار سبک بومی مناسب را برای مقصد اعمال می کند. سبک های بومی درست مانند تبلیغات بنری با استفاده از AdManagerAdView
پیاده سازی می شوند. آنها را می توان با اندازه تبلیغات ثابت که از قبل تعیین شده است، یا اندازه تبلیغ سیال تعیین شده در زمان اجرا استفاده کرد.
پیش نیازها
- افزونه Flutter Ads Google Mobile نسخه 0.13.6 یا بالاتر
این راهنما اطلاعاتی در مورد Google Mobile Ads SDK در نظر گرفته است. اگر قبلاً این کار را نکردهاید، راهنمای شروع ما را در نظر بگیرید.
اندازه ثابت
سبک های بومی با اندازه ثابت به شما امکان می دهد عرض و ارتفاع تبلیغات بومی را کنترل کنید. برای تنظیم اندازه ثابت، مراحل زیر را دنبال کنید:
یک آیتم خط در رابط کاربری Ad Manager ایجاد کنید و یکی از اندازه های از پیش تعریف شده را از قسمت کشویی فیلد Size
انتخاب کنید.
یک AdManagerBannerAd
با همان اندازه ای که در مرحله 1 تنظیم کردید بارگیری کنید. برای نحوه نمونه سازی و بارگیری یک تبلیغ به مستندات آگهی بنر مراجعه کنید. شما می توانید لیستی از اندازه ها و ثابت های AdSize
مربوط به آنها را در بخش اندازه بنر مشاهده کنید.
در اینجا مثالی از نحوه تعیین اندازه ثابت، مانند اندازه تبلیغ MEDIUM_RECTANGLE
(300x250) آورده شده است:
AdManagerBannerAd ad = AdManagerBannerAd(
adUnitId: '<your-ad-unit>',
sizes: <AdSize>[AdSize.mediumRectangle],
request: AdManagerAdRequest(),
);
اندازه مایع
در برخی موارد، اندازه ثابت ممکن است منطقی نباشد. به عنوان مثال، ممکن است بخواهید عرض تبلیغ با محتوای برنامه شما مطابقت داشته باشد، اما به ارتفاع آن نیاز داشته باشید تا به صورت پویا و متناسب با محتوای تبلیغ تنظیم شود. برای رسیدگی به این مورد، میتوانید Fluid
بهعنوان اندازه تبلیغ در رابط کاربری Ad Manager تعیین کنید، که نشان میدهد اندازه آگهی در زمان اجرا در برنامه تعیین میشود. SDK یک ثابت AdSize
ویژه، 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();
},
),
نمایش تبلیغ سیال
پس از بارگیری تبلیغ شما، از FluidAdWidget
برای نمایش تبلیغات روان استفاده کنید. ارتفاع آن را طوری تنظیم میکند که با نمای آگهی پلت فرم زیرین مطابقت داشته باشد:
FluidAdWidget(
width: <your-width>,
ad: fluidAd,
);
نمونهای از اجرای اندازه تبلیغ Ad Manager Fluid را در برنامه مثال در Github مشاهده کنید.
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-09-02 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-09-02 بهوقت ساعت هماهنگ جهانی."],[[["\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)."]]