[英]AdMob SMART_BANNER not working in landscape mode
我在Android項目中使用SMART_BANNER。 它在縱向模式下正常工作,但當方向改變(到橫向)時,橫幅寬度保持不變。 這是我的adview布局:
<LinearLayout
android:id="@+id/adLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#000000"
android:orientation="vertical" >
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
ads:adSize="SMART_BANNER"
app.backgroundColor ="#000000"
ads:adUnitId="xxxxxxx"
android:gravity="center" >
</com.google.android.gms.ads.AdView>
</LinearLayout>
我也嘗試過android:layout_width="wrap_content"
用於包含橫幅的LinearLayout和用於AdView的android:layout_width="match_parent"
- 沒有任何反應。
檢查maniefest中沒有類似下面的行 -
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
是的,smart_banner無法在橫向模式下工作。 所以改變它
廣告:adSize時= “大旗”
如果您在AdView已加載一個或多個廣告后更改應用程序的方向,則在更改方向時,它不會自動調整視圖大小。
在這種情況下,您應該覆蓋onConfigurationChanged
以跟蹤方向更改,並在方向更改時重新創建AdView。 這個堆棧溢出問題似乎有一個例子,但我自己沒有嘗試過。
通常,SMART_BANNER在橫向模式下似乎具有相當低的填充率。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.