LinearLayout底部的Adview Banner涵盖了Android中的图像按钮

时间:2017-05-15 18:47:47

标签: android android-linearlayout android-cardview adview

我希望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>

提前致谢。

1 个答案:

答案 0 :(得分:0)

我只是通过添加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>
相关问题