![](/img/trans.png)
[英]Native Ad Express Admob only shows if I specify the width and height to a certain dp
[英]Admob ad with 100% screen width and custom(90dp) height
我試圖顯示一個完全覆蓋屏幕寬度(如 SMART_BANNER)和 90dp 恆定高度的 admob 廣告。
使用此代碼,我可以將高度設置為 90dp,但是如何使廣告寬度填充寬度?
AdSize adSize = new AdSize(deviceSpecificWidth, 90);
根據這個,這些都是SMART_BANNER的標准尺寸
屏幕寬度 x 32|50|90
我可以強制智能橫幅在每個設備中只使用 90dp 的高度嗎?
我建議使用新推出的AdMob 自適應橫幅。 它們不需要在您身邊進行調整,它們利用所有可用的寬度並保持縱橫比(這是以前的問題)。
將它們嵌入到 FrameLayout 中,如下所示
<FrameLayout
android:id="@+id/adFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_gravity="center|bottom" />
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.