Адаптивные баннеры позволяют задать ширину объявления для определения его оптимального размера. Адаптивные баннеры также повышают эффективность, оптимизируя размер объявления для каждого устройства. Такой подход позволяет повысить производительность.
По сравнению с закреплёнными адаптивными баннерами, встроенные адаптивные баннеры больше, выше и имеют переменную, а не фиксированную высоту. Встроенные адаптивные баннеры имеют переменную высоту и могут занимать весь экран или достигать заданной вами максимальной высоты.
Вы размещаете встроенные адаптивные баннеры в прокручиваемом контенте, например:
Прежде чем начать
Прежде чем продолжить, убедитесь, что вы ознакомились с руководством по началу работы Баннерная реклама .
Внедрите адаптивные баннеры
В отличие от закрепленных адаптивных баннеров, встроенные баннеры-адаптеры загружаются с использованием размера встроенного адаптивного баннера. Чтобы создать встроенное адаптивное объявление, выполните следующие действия:
Укажите ширину используемого устройства или задайте собственную ширину, если вы не хотите использовать всю ширину экрана.
Используйте соответствующие статические методы в классе размера рекламы, например AdSize.getCurrentOrientationInlineAdaptiveBannerAdSize(Context context, int width) чтобы получить встроенный адаптивный объект размера рекламы для выбранной ориентации.
При внедрении адаптивных баннеров в ваше приложение обратите внимание на следующие моменты:
Размеры встроенных адаптивных баннеров лучше всего работают при использовании всей доступной ширины. В большинстве случаев этот размер равен полной ширине экрана используемого устройства или полной ширине родительского контента баннера. Вам необходимо знать ширину области, в которой будет размещаться объявление, ширину устройства, ширину родительского контента и применимые безопасные зоны.
Для работы с адаптивными размерами вам может потребоваться обновить или создать новые позиции. Подробнее .
Ориентировать размер встроенного адаптивного баннера
Для предварительной загрузки встроенного адаптивного баннера для определенной ориентации используйте следующие методы:
По умолчанию для встроенных адаптивных баннеров, созданных без значения maxHeight , значение maxHeight равно высоте устройства. Чтобы ограничить высоту встроенного адаптивного баннера, используйте метод AdSize.getInlineAdaptiveBannerAdSize(int width, int maxHeight) .
Дополнительные ресурсы
Примеры на GitHub
Загрузите пример приложения, чтобы увидеть встроенные адаптивные баннеры в действии.
[[["Прост для понимания","easyToUnderstand","thumb-up"],["Помог мне решить мою проблему","solvedMyProblem","thumb-up"],["Другое","otherUp","thumb-up"]],[["Отсутствует нужная мне информация","missingTheInformationINeed","thumb-down"],["Слишком сложен/слишком много шагов","tooComplicatedTooManySteps","thumb-down"],["Устарел","outOfDate","thumb-down"],["Проблема с переводом текста","translationIssue","thumb-down"],["Проблемы образцов/кода","samplesCodeIssue","thumb-down"],["Другое","otherDown","thumb-down"]],["Последнее обновление: 2025-09-03 UTC."],[[["\u003cp\u003eAdaptive banners optimize ad size for each device, maximizing performance and improving viewability.\u003c/p\u003e\n"],["\u003cp\u003eInline adaptive banners, placed within scrolling content, are larger and use variable heights compared to anchored adaptive banners.\u003c/p\u003e\n"],["\u003cp\u003eYou can control the width and maximum height of inline adaptive banners to fit your layout.\u003c/p\u003e\n"],["\u003cp\u003eImplement inline adaptive banners by specifying the ad size and ad unit ID, and load them using an AdManagerAdRequest.\u003c/p\u003e\n"],["\u003cp\u003eEnsure your Ad Manager line items support adaptive sizes for optimal delivery.\u003c/p\u003e\n"]]],["Inline adaptive banners, which are larger and use variable heights compared to anchored banners, optimize ad size for each device and enhance performance. Implementation involves determining ad width, using methods like `AdSize.getCurrentOrientationInlineAdaptiveBannerAdSize` or `AdSize.getInlineAdaptiveBannerAdSize` to get an ad size object, setting the size with `setAdSizes`, and loading the ad with `loadAd`. They can be preloaded for specific orientations or have height limitations using the `maxHeight` parameter. These banners work best at full width and require setting the right width and height.\n"],null,["Select platform: [Android](/ad-manager/mobile-ads-sdk/android/banner/inline-adaptive \"View this page for the Android platform docs.\") [iOS](/ad-manager/mobile-ads-sdk/ios/banner/inline-adaptive \"View this page for the iOS platform docs.\") [Flutter](/ad-manager/mobile-ads-sdk/flutter/banner/inline-adaptive \"View this page for the Flutter platform docs.\")\n\n\u003cbr /\u003e\n\nAdaptive banners let you specify the width of an ad to determine the optimal\nad size. Adaptive banners also maximize performance by optimizing the ad size\nfor each device. This approach results in opportunities for\nimproved performance.\n\nCompared to anchored adaptive banners, inline adaptive banners are larger,\ntaller, and use variable instead of fixed heights. Inline adaptive banners are\nof variable height, and might encompass the entire screen or a maximum height\nthat you specify.\n\nYou place inline adaptive banners in scrolling content, for example:\n\nBefore you begin\n\nBefore continuing, make sure you have completed the getting started guide,\n[Banner ads](/ad-manager/mobile-ads-sdk/android/banner).\n\nImplement adaptive banners\n\nUnlike anchored adaptive banners, inline adapter banners load using an inline\nadaptive banner size. To create an inline adaptive ad size, complete the\nfollowing:\n\n1. Get the width of the device in use, or set your own width if you don't want\n to use the full width of the screen.\n\n Kotlin \n\n private val adWidth: Int\n get() {\n val displayMetrics = resources.displayMetrics\n val adWidthPixels =\n if (Build.VERSION.SDK_INT \u003e= Build.VERSION_CODES.R) {\n val windowMetrics: WindowMetrics = this.windowManager.currentWindowMetrics\n windowMetrics.bounds.width()\n } else {\n displayMetrics.widthPixels\n }\n val density = displayMetrics.density\n return (adWidthPixels / density).toInt()\n } \n https://github.com/googleads/googleads-mobile-android-examples/blob/ccc290a583d7f552bdcf81ea76adc05beaa43f0b/kotlin/advanced/InlineAdaptiveBannerExample/app/src/main/java/com/google/android/gms/example/inlineadaptivebannerexample/MainActivity.kt#L70-L83\n\n Java \n\n public int getAdWidth() {\n DisplayMetrics displayMetrics = getResources().getDisplayMetrics();\n int adWidthPixels = displayMetrics.widthPixels;\n\n if (VERSION.SDK_INT \u003e= VERSION_CODES.R) {\n WindowMetrics windowMetrics = this.getWindowManager().getCurrentWindowMetrics();\n adWidthPixels = windowMetrics.getBounds().width();\n }\n\n float density = displayMetrics.density;\n return (int) (adWidthPixels / density);\n } \n https://github.com/googleads/googleads-mobile-android-examples/blob/ccc290a583d7f552bdcf81ea76adc05beaa43f0b/java/advanced/InlineAdaptiveBannerExample/app/src/main/java/com/google/android/gms/example/inlineadaptivebannerexample/MainActivity.java#L133-L145\n\n2. Use the appropriate static methods on the ad size class, such as\n\n `AdSize.getCurrentOrientationInlineAdaptiveBannerAdSize(Context context, int width)`\n\n to get an inline adaptive ad size object for the chosen orientation.\n\n Kotlin \n\n val adView = AdView(this@MainActivity)\n adView.setAdSize(AdSize.getCurrentOrientationInlineAdaptiveBannerAdSize(this, adWidth)) \n https://github.com/googleads/googleads-mobile-android-examples/blob/ccc290a583d7f552bdcf81ea76adc05beaa43f0b/kotlin/advanced/InlineAdaptiveBannerExample/app/src/main/java/com/google/android/gms/example/inlineadaptivebannerexample/MainActivity.kt#L120-L121\n\n Java \n\n final AdView adView = new AdView(MainActivity.this);\n adView.setAdSize(AdSize.getCurrentOrientationInlineAdaptiveBannerAdSize(this, getAdWidth())); \n https://github.com/googleads/googleads-mobile-android-examples/blob/ccc290a583d7f552bdcf81ea76adc05beaa43f0b/java/advanced/InlineAdaptiveBannerExample/app/src/main/java/com/google/android/gms/example/inlineadaptivebannerexample/MainActivity.java#L154-L155\n\n| **Important:** Ad Manager reservation ad sizes can be served in the same ad slot as adaptive banner sized ads. In order to use adaptive banners with Ad Manager reservation ads in the same ad slot, call `setAdSizes` with a list of sizes containing the adaptive size *in addition to* all sizes of reservation ads.\n\nWhen implementing adaptive banners in your app, note these points:\n\n- The inline adaptive banner sizes work best when using the full available width. In most cases, this size is the full width of the device screen in use, or the full width of the banner's parent content. You must know the width of the view to place in the ad, the device width, the parent content width, and applicable safe areas.\n\n\u003c!-- --\u003e\n\n- You may need to update or create new line items to work with adaptive sizes. [Learn more](//support.google.com/admanager/answer/9464128).\n\nOrient inline adaptive banner size\n\nTo preload an inline adaptive banner ad for a specific orientation, use the\nfollowing methods:\n\n- [`AdSize.getPortraitInlineAdaptiveBannerAdSize(Context context, int width)`](/ad-manager/mobile-ads-sdk/android/reference/com/google/android/gms/ads/AdSize#getPortraitInlineAdaptiveBannerAdSize(android.content.Context,int))\n\n- [`AdSize.getLandscapeInlineAdaptiveBannerAdSize(Context context, int width)`](/ad-manager/mobile-ads-sdk/android/reference/com/google/android/gms/ads/AdSize#getLandscapeInlineAdaptiveBannerAdSize(android.content.Context,int))\n\nIf your app supports both portrait and landscape views, and you want to preload\nan adaptive banner ad in the current orientation, use\n\n[`AdSize.getCurrentOrientationInlineAdaptiveBannerAdSize(Context context, int width)`](/ad-manager/mobile-ads-sdk/android/reference/com/google/android/gms/ads/AdSize#getCurrentOrientationInlineAdaptiveBannerAdSize(android.content.Context,int))\n\nThis method loads an ad in the current orientation.\n\nLimit inline adaptive banner height\n\nBy default, inline adaptive banners instantiated without a `maxHeight` value\nhave a `maxHeight` equal to the device height. To limit the inline adaptive\nbanner height, use the\n\n[`AdSize.getInlineAdaptiveBannerAdSize(int width, int maxHeight)`](/ad-manager/mobile-ads-sdk/android/reference/com/google/android/gms/ads/AdSize#getInlineAdaptiveBannerAdSize(int,int))\n\nmethod.\n\nAdditional resources\n\nExamples on GitHub\n\nDownload the sample application to see inline adaptive banners in action.\n\n[Java](//github.com/googleads/googleads-mobile-android-examples/tree/main/java/advanced/InlineAdaptiveBannerExample)\n[Kotlin](//github.com/googleads/googleads-mobile-android-examples/tree/main/kotlin/advanced/InlineAdaptiveBannerExample)\n\n\u003cbr /\u003e"]]