美文网首页
Toolbar遮住Recyclerview

Toolbar遮住Recyclerview

作者: 北国雪WRG | 来源:发表于2018-12-26 15:46 被阅读10次

注意:使用SwipeRefreshLayout包裹RecyclerView需要把app:layout_behavior="@string/appbar_scrolling_view_behavior"这句添加到SwipeRefreshLayout中。

下面是布局文件

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            app:layout_scrollFlags="snap|enterAlways|scroll"
            app:title="目录" />
    </android.support.design.widget.AppBarLayout>

    <android.support.v4.widget.SwipeRefreshLayout
        android:id="@+id/srl_flash"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

        <android.support.v7.widget.RecyclerView
            android:id="@+id/rv_files"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
        </android.support.v7.widget.RecyclerView>
    </android.support.v4.widget.SwipeRefreshLayout>
</android.support.design.widget.CoordinatorLayout>

相关文章

网友评论

      本文标题:Toolbar遮住Recyclerview

      本文链接:https://www.haomeiwen.com/subject/gmihlqtx.html