スマートバナー
スマートバナーは、あらゆる画面サイズのデバイスで、画面をどの向きにしていても横幅いっぱいに広告を表示できる広告ユニットです。デバイスの向きに応じて画面の横幅が検知され、そのサイズの広告ビューが作成されます。
スマートバナーで表示される広告の高さは、次の 3 つのいずれかになります。
広告の高さ |
画面の高さ |
32 dp |
400 dp 以下 |
50 dp |
400 dp 超、720 dp 以下 |
90 dp |
720 dp 超 |
通常では、スマートフォン向けのスマートバナーの高さは縦向きで 50 dp、横向きで 32 dp になります。タブレットの場合、通常ではどちらの向きでも高さが 90 dp になります。
イメージ広告の大きさが割り当てられたスペース全体に満たない場合は、画像が中央寄せになり、両側のスペースが塗りつぶされます。

スマートバナーを XML で使用するには、定数値 SMART_BANNER
を広告サイズとして指定し、AdView
の幅を match_parent
に設定します。次に例を示します。
<com.google.android.gms.ads.admanager.AdManagerAdView
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.admanager.AdManagerAdView>
スマートバナーをプログラムで作成する場合は、次のように AdSize.SMART_BANNER
を広告サイズとして使用します。
AdManagerAdView adView = new AdManagerAdView(this);
adView.setAdSizes(AdSize.SMART_BANNER);
val adView = AdManagerAdView(this)
adView.adSizes = AdSize.SMART_BANNER
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-02-25 UTC。
[null,null,["最終更新日 2025-02-25 UTC。"],[[["Smart Banners are responsive ad units that automatically adjust their size to fit the width of the device screen."],["Smart Banners have three possible ad heights (32dp, 50dp, 90dp) depending on the screen height of the device."],["When using Smart Banners, specify `SMART_BANNER` as the `adSize` and set the `AdView` width to `match_parent`."],["Consider using newer adaptive banners instead of Smart Banners for enhanced functionality."]]],["Smart Banners display screen-width ads, adapting to device size and orientation. They use three ad heights: 32 dp (≤ 400 dp screen height), 50 dp (\u003e 400 dp and ≤ 720 dp), and 90 dp (\u003e 720 dp). To implement in XML, set `adSize` to `SMART_BANNER` and `AdView` width to `match_parent`. Programmatically, utilize `AdSize.SMART_BANNER`. Image ads are centered when smaller than the space. The content suggests using adaptive banners instead.\n"]]