2013-03-15 116 views
0

我是android.I初學者使用webview和綜合admob廣告橫幅製作了Flash遊戲android應用程序,但它覆蓋了webview.I需要它出現像這樣pic http://i46.tinypic.com/2cosrjp.png 這是我的代碼:android佈局覆蓋問題

 <?xml version="1.0" encoding="utf-8"?> 

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" > 

<RelativeLayout 
android:id="@+id/lay" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" > 

<WebView 
    android:id="@+id/webview" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" /> 

</RelativeLayout> 

<com.google.ads.AdView 
    android:id="@+id/adView" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    ads:adSize="BANNER" 
    ads:adUnitId="a1513fab869115a" 
    ads:loadAdOnCreate="true" 
    ads:testDevices="TEST_EMULATOR, TEST_DEVICE_ID" /> 

</RelativeLayout> 

回答

0

添加android:layout_below="+id/lay"你webView的視圖中

<RelativeLayout 
android:id="@+id/lay" 
android:layout_below="@+id/adView" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" > 

<WebView 
    android:id="@+id/webview" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" /> 

</RelativeLayout> 

添加android:layout_alignParentTop="true"在廣告視圖

<com.google.ads.AdView 
android:id="@+id/adView" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:layout_alignParentTop="true" 
ads:adSize="BANNER" 
ads:adUnitId="a1513fab869115a" 
ads:loadAdOnCreate="true" 
ads:testDevices="TEST_EMULATOR, TEST_DEVICE_ID" /> 
+0

@ A.Jouni ok.Check日誌貓是什麼錯誤? – 2013-03-15 18:01:29

+0

太棒了!廣告橫幅大小是否會減少? – 2013-03-15 18:02:20

+0

android:layout_height =「40dp」或測試後可以提供的任何大小。 – 2013-03-15 18:03:33

0

即使RelativeLayout的可能是許多用例的首選,對於這個簡單的觀點,我會用一個LinearLayout,這是容易得多。

0

我得到了oppiste錯誤,我想我的應用程序顯示你的,我不能得到它,我有你想要的答案。

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:ads="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="vertical" 
    android:weightSum="1"> 


    <com.google.android.gms.ads.AdView android:id="@+id/adView" 
     android:layout_width="355dp" 
     android:layout_height="wrap_content" 
     ads:adUnitId="000000000000000000" 
     ads:adSize="BANNER" 
     android:layout_gravity="center_horizontal|bottom" /> 

    <WebView 
     android:layout_width="match_parent" 
     android:layout_height="fill_parent" 
     android:id="@+id/tropas" 
     android:layout_weight="1.01" /> 

</LinearLayout> 

這是我的代碼,並在上面覆蓋不顯示的WebView Aadmob