android admob适用于屏幕但隐藏了ScrollView中的其他按钮

时间:2014-10-30 11:10:51

标签: android

我正在尝试在屏幕底部添加admob。它显示广告,但它显示在所有按钮的底部,也隐藏了注销按钮。我也看到了这个网站的其他问题,但它没有解决我的问题。一些人帮我解决了我的错误或我必须做些什么来解决它。

 <?xml version="1.0" encoding="utf-8"?>
 <ScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ads="http://schemas.android.com/apk/res-auto" 
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >
<RelativeLayout 
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical" >
     ...
     //I just delete other buttons
     //but search also here
    ....

    <Button
        android:id="@+id/but_logout"
        style="@style/login"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/but_search"
        android:layout_marginLeft="30dp"
        android:layout_marginRight="30dp"
        android:layout_marginTop="8dp"
        android:onClick="click_but_logout"
        android:text="@string/label_logout" />
    <com.google.android.gms.ads.AdView
    android:id="@+id/adView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    ads:adSize="BANNER"
    ads:adUnitId="@string/ad_unit_id"/>     

</RelativeLayout>
</ScrollView>

1 个答案:

答案 0 :(得分:1)

试试这个:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ads="http://schemas.android.com/apk/res-auto"  >
 <ScrollView
    android:layout_alignParentTop="true"
    android:layout_above="@+id/adView"
    android:layout_marginBottom="20dp"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >
<RelativeLayout 
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical" >
     ...
     //I just delete other buttons
     //but search also here
    ....

    <Button
        android:id="@+id/but_logout"
        style="@style/login"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/but_search"
        android:layout_marginLeft="30dp"
        android:layout_marginRight="30dp"
        android:layout_marginTop="8dp"
        android:onClick="click_but_logout"
        android:text="@string/label_logout" />


</RelativeLayout>
</ScrollView>    
<com.google.android.gms.ads.AdView
    android:id="@+id/adView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    ads:adSize="BANNER"
    ads:adUnitId="@string/ad_unit_id"/> 
</RelativeLayout>