Select platform: [Android](https://developers.google.com/admob/android/banner/smart "View this page for the Android platform docs.") [iOS](https://developers.google.com/admob/ios/banner/smart "View this page for the iOS platform docs.") [Unity](https://developers.google.com/admob/unity/banner/smart "View this page for the Unity platform docs.")

<br />

| Try the newer [adaptive banners](https://developers.google.com/admob/android/banner/anchored-adaptive) instead.

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.

![](https://developers.google.com/static/admob/images/smartfill.png)

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:  

```scdoc
<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

```java
AdView adView = new AdView(this);
adView.setAdSize(AdSize.SMART_BANNER);
```

### Kotlin

```kotlin
val adView = AdView(this)
adView.adSize = AdSize.SMART_BANNER
```