تبلیغات بنری تطبیقی ​​لنگردار

Adaptive banners provide a flexible way to display ads, with a user-specified width and a Google-optimized height. The minimum banner height is 50 density-independent pixels, while the maximum is capped at 15% of the device's height or 90 density-independent pixels, whichever is smaller.

این بنرها زمانی بهترین عملکرد را دارند که از تمام عرض موجود استفاده کنند، اما همیشه باید هنگام تنظیم عرض بنر، مناطق امن و بریدگی‌های نمایشی را که ممکن است مانع دید شوند، در نظر بگیرید.

پیش‌نیازها

همیشه با تبلیغات آزمایشی تست کنید

The following sample code contains an ad unit ID which you can use to request test ads. It's been specially configured to return test ads rather than production ads for every request, making it safe to use.

However, after you've registered an app in the Ad Manager web interface and created your own ad unit IDs for use in your app, explicitly configure your device as a test device during development.

/21775744923/example/adaptive-banner

یک بنر تطبیقی ​​​​متصل ایجاد کنید

مثال زیر یک نمای بنر تطبیقی ​​متصل ایجاد می‌کند که در پایین صفحه قرار می‌گیرد:

// Get the device safe width in density-independent pixels.
int deviceWidth = MobileAds.Utils.GetDeviceSafeWidth();

// Define the anchored adaptive ad size.
AdSize adaptiveSize =
    AdSize.GetCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth(deviceWidth);

// Create an anchored adaptive banner view.
adManagerBannerView = new AdManagerBannerView("AD_UNIT_ID", adaptiveSize, AdPosition.Bottom);

AD_UNIT_ID با شناسه واحد تبلیغاتی خود جایگزین کنید.

با ایجاد نمای بنر تطبیقی ​​متصل، اکنون می‌توانید بنر را همانطور که در راهنمای شروع به کار توضیح داده شده است، بارگذاری کنید.