大小固定的橫幅廣告
    
    
      
    
    
      
      透過集合功能整理內容
    
    
      
      你可以依據偏好儲存及分類內容。
    
  
    
  
      
    
  
  
  
  
  
    
    
    
  
  
    
    
    
  
  
  
  
  
    
    
      
    
      
    
      
    
  
  
  
如果自動調整橫幅廣告不符合需求,Google Mobile Ads SDK 也支援固定大小的廣告。
下表列出標準橫幅大小。
  
    | 尺寸 (寬 x 高,以 dp 為單位) | 說明 | 適用裝置 | AdSize 常數 | 
  
    | 320x50 | 橫幅廣告 | 手機和平板電腦 | GADAdSizeBanner | 
  
    | 320x100 | 大型橫幅廣告 | 手機和平板電腦 | GADAdSizeLargeBanner | 
  
    | 300x250 | IAB 中矩形廣告 | 手機和平板電腦 | GADAdSizeMediumRectangle | 
  
    | 468x60 | IAB 完整大小橫幅廣告 | 平板電腦 | GADAdSizeFullBanner | 
  
    | 728x90 | IAB 超級橫幅廣告 | 平板電腦 | GADAdSizeLeaderboard | 
如要定義自訂橫幅廣告的大小,請使用 GADAdSizeFromCGSize 進行設定:
Swift
let adSize = adSizeFor(cgSize: CGSize(width: 250, height: 250))
Objective-C
GADAdSize size = GADAdSizeFromCGSize(CGSizeMake(250, 250));
 
固定大小橫幅廣告範例
Swift 
Objective-C 
  
  
  
    
  
 
  
    
      
      
    
    
      
    
    
  
       
    
    
      
    
  
  
  除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
  上次更新時間:2025-10-20 (世界標準時間)。
  
  
  
    
      [[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-10-20 (世界標準時間)。"],[],["The Google Mobile Ads SDK supports fixed-size banner ads with standard sizes for phones and tablets. Available sizes include 320x50 (Banner), 320x100 (Large banner), 300x250 (IAB medium rectangle), 468x60 (IAB full-size banner), and 728x90 (IAB leaderboard), each with a corresponding `GADAdSize` constant. Custom sizes can be set using `GADAdSizeFromCGSize`, demonstrated in Swift and Objective-C examples provided in the documentation.\n"]]