【问题标题】:Adview Banner at bottom of LinearLayout covers imagebuttons in AndroidLinearLayout 底部的 Adview Banner 覆盖了 Android 中的 imagebuttons
【发布时间】:2017-05-15 18:47:47
【问题描述】:

我希望 AdView 显示在屏幕底部,但它隐藏了图像按钮,我将重力设置为底部,并将布局重力设置为底部,即使我没有运气。请帮忙

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ads="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/grey">
    <TextView
        android:layout_width="wrap_content"
        android:textColor="@color/colorPrimaryDark"
        android:textSize="40dp"
        android:textStyle="bold"
        android:text="@string/end"
        android:layout_height="wrap_content"
        android:layout_gravity="center"/>
    <TextView
        android:layout_width="wrap_content"
        android:textColor="@color/colorPrimaryDark"
        android:textSize="18dp"
        android:textStyle="bold"
        android:text="@string/end2"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_marginTop="30dp"/>
    <com.mindorks.placeholderview.SwipePlaceHolderView
        android:id="@+id/swipeView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>
    <LinearLayout
        android:id="@+id/ll10"
        android:layout_alignParentTop="true"
        android:layout_above="@+id/adView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:gravity="center"
        android:orientation="horizontal" >
        <ImageButton
            android:id="@+id/rejectBtn"
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:background="@drawable/ic_skip"/>
        <ImageButton
            android:id="@+id/viewBtn"
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:layout_marginLeft="50dp"
            android:background="@drawable/ic_view"/>
        <ImageButton
            android:id="@+id/acceptBtn"
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:layout_marginLeft="50dp"
            android:background="@drawable/ic_heart"/>
    </LinearLayout>
    <com.google.android.gms.ads.AdView
        android:id="@+id/adView02"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_below="@id/ll10"
        android:layout_centerHorizontal="true"
        android:layout_gravity="bottom"
        ads:adSize="SMART_BANNER"
        ads:adUnitId="@string/banner_ad_unit_id02">
    </com.google.android.gms.ads.AdView>
</FrameLayout>

提前致谢。

【问题讨论】:

    标签: android android-linearlayout android-cardview adview


    【解决方案1】:

    我只是通过添加 relativelayout 来修复它:

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:ads="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
    
    <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"/>
    
     <com.google.android.gms.ads.AdView
            android:id="@+id/adView02"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom"
            ads:adSize="SMART_BANNER"
            ads:adUnitId="@string/banner_ad_unit_id"></com.google.android.gms.ads.AdView>
    
    </RelativeLayout>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-10-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多