我試圖讓我的webview坐在我的Google Ad Mob廣告上方。但是,除非以編程方式嘗試和調整高度,否則Web視圖始終覆蓋整個屏幕。我試着將webview的高度設置爲屏幕高度減去我的廣告高度,但這似乎並不能在所有設備上準確地工作。如果我希望我的廣告坐在網頁視圖的下方,我的webview的高度應該設置爲多少?如何確保我的webview可以隨設備一起擴展?
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:id="@+id/linearLayout">
<WebView
android:id="@+id/webView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
<com.google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/adView"
android:layout_width="320dip"
android:layout_height="50dip"
ads:adUnitId="/serviceid/myadtagishere"
ads:adSize="BANNER"
android:layout_below="@+id/webView1"/>
</RelativeLayout>
因爲高度設置爲FILL_PARENT和廣告低於 – Decoy
我試着將它設置爲剛纔的一切,我能明顯地將它設置爲500浸,但當然不會每個設備規模。 – Caimen
只需在您的廣告視圖中移除layout_below並設置align_ParentBottom = true – Decoy