Smart Banners
Stay organized with collections
Save and categorize content based on your preferences.
Smart Banners are ad units that render screen-width banner ads on any screen
size across different devices in either orientation. Smart Banners detect the
width of the device in its current orientation and create the ad view that size.
Three ad heights are implemented in smart banners:
Ad height |
Screen height |
32 dp |
≤ 400 dp |
50 dp |
> 400 dp and ≤ 720 dp |
90 dp |
> 720 dp |
Typically, Smart Banners on phones have a height of 50 dp in portrait and 32 dp
in landscape. On tablets, height is normally 90 dp in both orientations.
When an image ad isn't large enough to take up the entire allotted space, the
image will be centered, and the space on either side will be filled in.

To use Smart Banners in XML, specify the constant SMART_BANNER
for the ad
size and set the width of the AdView
to match_parent
. For example:
<com.google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
ads:adSize="SMART_BANNER"
ads:adUnitId="ca-app-pub-3940256099942544/6300978111">
</com.google.android.gms.ads.AdView>
To create a Smart Banner programmatically, use AdSize.SMART_BANNER
as the ad
size:
Java
AdView adView = new AdView(this);
adView.setAdSize(AdSize.SMART_BANNER);
Kotlin
val adView = AdView(this)
adView.adSize = AdSize.SMART_BANNER
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-02-20 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-20 UTC."],[[["Smart Banners are responsive ad units that adjust their size to fit the width of the device screen across various devices and orientations."],["They automatically determine the appropriate ad height (32 dp, 50 dp, or 90 dp) based on the screen height of the device."],["It is recommended to use the newer adaptive banners for better performance and user experience."],["Smart Banners can be easily implemented in XML by setting the `adSize` to `SMART_BANNER` and the `AdView` width to `match_parent`, or programmatically by using `AdSize.SMART_BANNER`."]]],[]]