इनलाइन अडैप्टिव बैनर
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
प्लैटफ़ॉर्म चुनें:
Android
iOS
Flutter
अडैप्टिव बैनर की मदद से, विज्ञापन की चौड़ाई तय की जा सकती है, ताकि विज्ञापन का सबसे सही साइज़ तय किया जा सके. अडैप्टिव बैनर, हर डिवाइस के लिए विज्ञापन के साइज़ को ऑप्टिमाइज़ करके, परफ़ॉर्मेंस को भी बेहतर बनाते हैं. इस तरीके से, परफ़ॉर्मेंस को बेहतर बनाने के अवसर मिलते हैं.
ऐंकर किए गए अडैप्टिव बैनर की तुलना में, इनलाइन अडैप्टिव बैनर बड़े और लंबे होते हैं. इनकी कोई तय लंबाई नहीं होती, बल्कि ये डिवाइस की स्क्रीन के हिसाब से खुद को इस तरह फ़िट कर लेते हैं जिससे कि पूरी स्क्रीन पर दिख सकें. इनलाइन अडैप्टिव बैनर की लंबाई कम या ज़्यादा की जा सकती है. ये पूरी स्क्रीन पर दिख सकते हैं या आपकी तय की गई ज़्यादा से ज़्यादा लंबाई में दिख सकते हैं.
इनलाइन अडैप्टिव बैनर को स्क्रोल किए जा सकने वाले कॉन्टेंट में रखा जाता है. उदाहरण के लिए:

शुरू करने से पहले
जारी रखने से पहले, पक्का करें कि आपने बैनर विज्ञापनों के लिए, शुरू करने से जुड़ी गाइड पढ़ ली हो.
अडैप्टिव बैनर लागू करना
ऐंकर किए गए अडैप्टिव बैनर के उलट, इनलाइन अडैप्टर बैनर, इनलाइन अडैप्टिव बैनर के साइज़ का इस्तेमाल करके लोड होते हैं. इनलाइन अडैप्टिव विज्ञापन का साइज़ बनाने के लिए, यह तरीका अपनाएं:
इस्तेमाल किए जा रहे डिवाइस की चौड़ाई पाएं या अगर आपको स्क्रीन की पूरी चौड़ाई का इस्तेमाल नहीं करना है, तो अपनी चौड़ाई सेट करें.
Kotlin
private val adWidth: Int
get() {
val displayMetrics = resources.displayMetrics
val adWidthPixels =
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
val windowMetrics: WindowMetrics = this.windowManager.currentWindowMetrics
windowMetrics.bounds.width()
} else {
displayMetrics.widthPixels
}
val density = displayMetrics.density
return (adWidthPixels / density).toInt()
}
Java
public int getAdWidth() {
DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
int adWidthPixels = displayMetrics.widthPixels;
if (VERSION.SDK_INT >= VERSION_CODES.R) {
WindowMetrics windowMetrics = this.getWindowManager().getCurrentWindowMetrics();
adWidthPixels = windowMetrics.getBounds().width();
}
float density = displayMetrics.density;
return (int) (adWidthPixels / density);
}
विज्ञापन के साइज़ वाली क्लास पर सही स्टैटिक तरीकों का इस्तेमाल करें. जैसे,
AdSize.getCurrentOrientationInlineAdaptiveBannerAdSize(Context context, int width)
चुने गए ओरिएंटेशन के लिए, इनलाइन अडैप्टिव विज्ञापन के साइज़ वाला ऑब्जेक्ट पाने के लिए.
Kotlin
val adView = AdView(this@MainActivity)
adView.setAdSize(AdSize.getCurrentOrientationInlineAdaptiveBannerAdSize(this, adWidth))
Java
final AdView adView = new AdView(MainActivity.this);
adView.setAdSize(AdSize.getCurrentOrientationInlineAdaptiveBannerAdSize(this, getAdWidth()));
अपने ऐप्लिकेशन में अडैप्टिव बैनर लागू करते समय, इन बातों का ध्यान रखें:
- इनलाइन अडैप्टिव बैनर के साइज़, उपलब्ध पूरी चौड़ाई का इस्तेमाल करने पर सबसे अच्छी तरह काम करते हैं. ज़्यादातर मामलों में, यह साइज़ इस्तेमाल किए जा रहे डिवाइस की स्क्रीन की पूरी चौड़ाई या बैनर के पैरंट कॉन्टेंट की पूरी चौड़ाई होती है. आपको विज्ञापन में दिखाने के लिए व्यू की चौड़ाई, डिवाइस की चौड़ाई, पैरंट कॉन्टेंट की चौड़ाई, और लागू होने वाले सुरक्षित क्षेत्रों के बारे में पता होना चाहिए.
इनलाइन अडैप्टिव बैनर के साइज़ को ओरिएंट करना
किसी खास ओरिएंटेशन के लिए, इनलाइन अडैप्टिव बैनर विज्ञापन को प्रीलोड करने के लिए, इन तरीकों का इस्तेमाल करें:
अगर आपका ऐप्लिकेशन पोर्ट्रेट और लैंडस्केप, दोनों व्यू के साथ काम करता है और आपको मौजूदा ओरिएंटेशन में अडैप्टिव बैनर विज्ञापन को प्रीलोड करना है, तो AdSize.getCurrentOrientationInlineAdaptiveBannerAdSize(Context context, int width)
का इस्तेमाल करें
यह तरीका, मौजूदा ओरिएंटेशन में विज्ञापन लोड करता है.
इनलाइन अडैप्टिव बैनर की ऊंचाई सीमित करना
डिफ़ॉल्ट रूप से, maxHeight
वैल्यू के बिना इंस्टैंटिएट किए गए इनलाइन अडैप्टिव बैनर में, maxHeight
की वैल्यू डिवाइस की ऊंचाई के बराबर होती है. इनलाइन अडैप्टिव बैनर की ऊंचाई को सीमित करने के लिए, AdSize.getInlineAdaptiveBannerAdSize(int width, int maxHeight)
तरीके का इस्तेमाल करें.
अन्य संसाधन
GitHub पर मौजूद उदाहरण
इनलाइन अडैप्टिव बैनर को काम करते हुए देखने के लिए, सैंपल ऐप्लिकेशन डाउनलोड करें.
Java
Kotlin
जब तक कुछ अलग से न बताया जाए, तब तक इस पेज की सामग्री को Creative Commons Attribution 4.0 License के तहत और कोड के नमूनों को Apache 2.0 License के तहत लाइसेंस मिला है. ज़्यादा जानकारी के लिए, Google Developers साइट नीतियां देखें. Oracle और/या इससे जुड़ी हुई कंपनियों का, Java एक रजिस्टर किया हुआ ट्रेडमार्क है.
आखिरी बार 2025-09-06 (UTC) को अपडेट किया गया.
[[["समझने में आसान है","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-06 (UTC) को अपडेट किया गया."],[[["\u003cp\u003eAdaptive banners optimize ad size for each device to maximize performance by letting you specify the ad width.\u003c/p\u003e\n"],["\u003cp\u003eInline adaptive banners, placed within scrolling content, are larger, taller, and use variable heights compared to anchored adaptive banners.\u003c/p\u003e\n"],["\u003cp\u003eYou can get an inline adaptive banner ad size using the \u003ccode\u003eAdSize\u003c/code\u003e class's static methods with device width or a custom width.\u003c/p\u003e\n"],["\u003cp\u003eFor specific orientation preloading or limiting banner height, utilize dedicated \u003ccode\u003eAdSize\u003c/code\u003e methods like \u003ccode\u003egetPortraitInlineAdaptiveBannerAdSize\u003c/code\u003e or \u003ccode\u003egetInlineAdaptiveBannerAdSize\u003c/code\u003e.\u003c/p\u003e\n"]]],["Inline adaptive banners, designed for scrolling content, allow specifying ad width for optimal sizing and performance. To implement, determine the device or desired ad width. Then, use methods like `AdSize.getCurrentOrientationInlineAdaptiveBannerAdSize` or `AdSize.getInlineAdaptiveBannerAdSize` to obtain an ad size object. Finally, load an ad using `AdView` and `AdRequest`. You may limit the ad's height, and specific orientation methods are available to load the ad.\n"],null,["Select platform: [Android](/admob/android/banner/inline-adaptive \"View this page for the Android platform docs.\") [iOS](/admob/ios/banner/inline-adaptive \"View this page for the iOS platform docs.\") [Flutter](/admob/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](/admob/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\u003cbr /\u003e\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\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)`](/admob/android/reference/com/google/android/gms/ads/AdSize#getPortraitInlineAdaptiveBannerAdSize(android.content.Context,int))\n\n- [`AdSize.getLandscapeInlineAdaptiveBannerAdSize(Context context, int width)`](/admob/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)`](/admob/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)`](/admob/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"]]