2013-03-15 115 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