Android:协调布局和布局

Android:协调布局和布局,android,android-appcompat,swiperefreshlayout,coordinator-layout,Android,Android Appcompat,Swiperefreshlayout,Coordinator Layout,我尝试从新的支持库22.2.0中实现自动隐藏工具栏功能。如果没有开关,布局工作正常: 但当我重新添加此布局时,工具栏与recyclerview重叠: 代码: 使用Androidx更新2020: 代码: 知道如何解决这个问题吗?将滚动行为设置为SwiperFreshLayout而不是RecyclerView @Tomas我想问您是否注意到,如果您开始滚动,直到AppBarLayout完全展开垂直偏移量达到0,并且您继续滚动,SwiperFreshLayout的刷新指示器将出现,因此用户也将能够触发

我尝试从新的支持库22.2.0中实现自动隐藏工具栏功能。如果没有开关,布局工作正常:

但当我重新添加此布局时,工具栏与recyclerview重叠:

代码:

使用Androidx更新2020:

代码:


知道如何解决这个问题吗?

将滚动行为设置为SwiperFreshLayout而不是RecyclerView


@Tomas我想问您是否注意到,如果您开始滚动,直到AppBarLayout完全展开垂直偏移量达到0,并且您继续滚动,SwiperFreshLayout的刷新指示器将出现,因此用户也将能够触发此操作。它很容易复制,至少在我这边,在RecyclerView上只有几个元素。任何帮助都将不胜感激。@zsoltboldizár请为我效劳
    <android.support.v4.widget.SwipeRefreshLayout
        android:id="@+id/swipe_container"
        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/cardList"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:scrollbars="vertical" />

    </android.support.v4.widget.SwipeRefreshLayout>