android admob 关闭了屏幕,但在 ScrollView 中隐藏了其他按钮

标签 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>

最佳答案

试试这个:

<?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>

关于android admob 关闭了屏幕,但在 ScrollView 中隐藏了其他按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26651444/

相关文章:

java - 在 Java/Android 中使用公历时获取错误的时间戳值

android - 无法使用名称中给定版本的 Maven 构建 apk

java - 如何为抽屉导航项目添加长按功能?

android - 以编程方式获取安卓手机的电话号码

java - Android 监听器是某种设计模式吗?

android - 如何在android中匹配“if else”条件中的字符串值?

android-widget - 如何在Android ListView中获取距顶部特定偏移量的项目索引

android - 在模拟器上检测互联网连接

android - 提示在 android 的 edittext 中不起作用

android - 数据库与列表