智能横幅广告
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
作为一种广告单元,智能横幅可在任何屏幕尺寸、任何屏幕方向的各种设备上展示与屏幕等宽的横幅广告。智能横幅可以检测设备处于当前屏幕方向时的宽度,并据此创建与之等宽的广告视图。
智能横幅可实现三种广告高度:
广告高度 |
屏幕高度 |
32 dp |
≤ 400 dp |
50 dp |
> 400 dp 且 ≤ 720 dp |
90 dp |
> 720 dp |
通常情况下,在手机上,当屏幕为纵向时,智能横幅广告高度为 50dp;当屏幕为横向时,广告高度为 32dp。在平板电脑上,不论屏幕是纵向还是横向,广告高度通常均为 90 dp。
当图片广告不足以占据所分配的整个空间时,系统会居中放置图片,然后填充两侧剩余的空间。

要使用智能横幅广告,请在创建 BannerView
时为广告尺寸指定 AdSize.SmartBanner
。例如:
// Create a Smart Banner at the top of the screen.
BannerView bannerView = new BannerView(adUnitId, AdSize.SmartBanner, AdPosition.Top);
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-25。
[null,null,["最后更新时间 (UTC):2025-08-25。"],[[["\u003cp\u003eSmart Banners are responsive ad units that adjust their size to fit the screen width of various devices and orientations.\u003c/p\u003e\n"],["\u003cp\u003eThey utilize three ad heights (32 dp, 50 dp, 90 dp) based on the screen height of the device.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers should use \u003ccode\u003eAdSize.SmartBanner\u003c/code\u003e when creating a \u003ccode\u003eBannerView\u003c/code\u003e to implement Smart Banners in their apps.\u003c/p\u003e\n"],["\u003cp\u003eConsider using adaptive banners as a newer alternative to Smart Banners for improved ad performance and flexibility.\u003c/p\u003e\n"]]],["Smart Banners render screen-width ads, adapting to any device size and orientation. They detect device width and create an ad view accordingly, using heights of 32 dp (≤ 400 dp screen height), 50 dp (\u003e 400 dp and ≤ 720 dp), or 90 dp (\u003e 720 dp). Image ads are centered when they don't fill the space. To implement, specify `AdSize.SmartBanner` when creating a `BannerView`, such as `new BannerView(adUnitId, AdSize.SmartBanner, AdPosition.Top)`.\n"],null,["# Smart Banners\n\nSelect platform: [Android](/admob/android/banner/smart \"View this page for the Android platform docs.\") [iOS](/admob/ios/banner/smart \"View this page for the iOS platform docs.\") [Unity](/admob/unity/banner/smart \"View this page for the Unity platform docs.\")\n\n\u003cbr /\u003e\n\n| Try the newer [adaptive banners](/admob/unity/banner/anchored-adaptive) instead.\n\nSmart Banners are ad units that render screen-width banner ads on any screen\nsize across different devices in either orientation. Smart Banners detect the\nwidth of the device in its current orientation and create the ad view that size.\n\nThree ad heights are implemented in smart banners:\n\n| Ad height | Screen height |\n|-----------|------------------------|\n| 32 dp | ≤ 400 dp |\n| 50 dp | \\\u003e 400 dp and ≤ 720 dp |\n| 90 dp | \\\u003e 720 dp |\n\nTypically, Smart Banners on phones have a height of 50 dp in portrait and 32 dp\nin landscape. On tablets, height is normally 90 dp in both orientations.\n\nWhen an image ad isn't large enough to take up the entire allotted space, the\nimage will be centered, and the space on either side will be filled in.\n\nTo use Smart Banners, specify the `AdSize.SmartBanner` for the ad size when\ncreating a `BannerView`. For example: \n\n```c#\n// Create a Smart Banner at the top of the screen.\nBannerView bannerView = new BannerView(adUnitId, AdSize.SmartBanner, AdPosition.Top);\n```"]]