Android AdView与RecyclerView的最后一项重叠

Android AdView与RecyclerView的最后一项重叠,android,android-recyclerview,adview,Android,Android Recyclerview,Adview,我希望随附的屏幕截图清楚地说明我的问题,RecyclerView列表中的最后一项与AdView重叠 将底部填充和边距添加到回收视图,在AdView后面的底部留下空白,这是不可取的 是否有任何方法可以设置超滚动或滚动偏移 任何快速解决方案/建议都会有帮助,提前谢谢 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"

我希望随附的屏幕截图清楚地说明我的问题,
RecyclerView
列表中的最后一项与
AdView
重叠

将底部填充和边距添加到
回收视图
,在
AdView
后面的底部留下空白,这是不可取的

是否有任何方法可以设置超滚动或滚动偏移

任何快速解决方案/建议都会有帮助,提前谢谢

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <android.support.v7.widget.RecyclerView
        android:id="@+id/rvProverbs"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:spanCount="4"
        />

    <com.google.android.gms.ads.AdView
        xmlns:ads="http://schemas.android.com/apk/res-auto"
        android:id="@+id/adView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_alignParentBottom="true"
        ads:adSize="BANNER"
        ads:adUnitId="@string/ad_unit_id">
    </com.google.android.gms.ads.AdView>


</RelativeLayout>

用户
android:layout_over=”“
RecyclerView
内设置属性,并将
AdView的id提供给用户


带有属性
adSize=“BANNER”
的横幅高度为50 dp

最简单的解决方案可能是在
RecyclerView
中添加50 dp(或更大)的底部填充,并设置为
false

<android.support.v7.widget.RecyclerView
    android:id="@+id/rvProverbs"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="50dp"
    android:clipToPadding="false"
    app:spanCount="4" />
请尝试此代码

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<android.support.v7.widget.RecyclerView
    android:id="@+id/rvProverbs"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:spanCount="4"
    android:layout_above="@+id/adView2"
    android:layout_marginBottom="10dp"

    />

<com.google.android.gms.ads.AdView
    xmlns:ads="http://schemas.android.com/apk/res-auto"
    android:id="@+id/adView2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_alignParentBottom="true"
    ads:adSize="BANNER"
    ads:adUnitId="@string/ad_unit_id">
</com.google.android.gms.ads.AdView>


这与android:layout_marginBottom=“一起使用效果最好
adView.setAdListener(new AdListener() {
    @Override
    public void onAdLoaded() {
        recyclerView.setPadding(0, 0, 0, adView.getHeight());
        // recyclerView.setClipToPadding(false);
    }
});
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<android.support.v7.widget.RecyclerView
    android:id="@+id/rvProverbs"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:spanCount="4"
    android:layout_above="@+id/adView2"
    android:layout_marginBottom="10dp"

    />

<com.google.android.gms.ads.AdView
    xmlns:ads="http://schemas.android.com/apk/res-auto"
    android:id="@+id/adView2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_alignParentBottom="true"
    ads:adSize="BANNER"
    ads:adUnitId="@string/ad_unit_id">
</com.google.android.gms.ads.AdView>