固定尺寸横幅广告
如果自适应横幅广告无法满足您的需求,Google 移动广告 SDK 支持固定广告尺寸。
下表列出了标准的横幅广告尺寸。
尺寸(宽 x 高,以 dp 为单位) |
说明 |
可用性 |
AdSize 常量 |
320x50 |
横幅 |
手机和平板电脑 |
GADAdSizeBanner |
320x100 |
大型横幅广告 |
手机和平板电脑 |
GADAdSizeLargeBanner |
300x250 |
IAB 中矩形 |
手机和平板电脑 |
GADAdSizeMediumRectangle |
468x60 |
IAB 全尺寸横幅广告 |
平板电脑 |
GADAdSizeFullBanner |
728x90 |
IAB 页首横幅广告 |
平板电脑 |
GADAdSizeLeaderboard |
如需指定自定义横幅广告尺寸,请使用 GADAdSizeFromCGSize
设置尺寸:
Swift
let adSize = GADAdSizeFromCGSize(CGSize(width: 250, height: 250))
Objective-C
GADAdSize size = GADAdSizeFromCGSize(CGSizeMake(250, 250));
固定尺寸横幅广告示例
Swift
Objective-C
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-02-02。
[null,null,["最后更新时间 (UTC):2025-02-02。"],[[["The Google Mobile Ads SDK offers fixed ad sizes as an alternative to adaptive banners."],["Standard banner sizes include Banner (320x50), Large Banner (320x100), IAB medium rectangle (300x250), IAB full-size banner (468x60), and IAB leaderboard (728x90), each with specified availability for phones and/or tablets."],["Custom banner sizes can be defined using `GADAdSizeFromCGSize` by providing the desired width and height."],["Code examples for implementing fixed size banner ads are available in both Swift and Objective-C."]]],[]]