Android RecyclerView inside Nested滚动视图inside Coordinator布局

Android RecyclerView inside Nested滚动视图inside Coordinator布局,android,android-recyclerview,toolbar,android-coordinatorlayout,Android,Android Recyclerview,Toolbar,Android Coordinatorlayout,我有这样的布局: <?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_wi

我有这样的布局:

    <?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:id="@+id/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="scroll|enterAlways"
            />
    </android.support.design.widget.AppBarLayout>

    <android.support.v4.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"
        android:layout_margin="20dp">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal">
            <android.support.v7.widget.AppCompatImageView
                android:layout_width="200dp"
                android:layout_height="200dp"
                android:src="@drawable/avatar_placeholder"
                />
            <android.support.v7.widget.RecyclerView
                android:layout_width="wrap_content"
                android:layout_height="200dp"
                android:layout_marginLeft="20dp"
                android:id="@+id/list"
                android:orientation="horizontal"
                app:layoutManager="android.support.v7.widget.LinearLayoutManager"
                />
        </LinearLayout>
    </android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>


可以看出,问题出在
RecyclerView
中。当我向上拖动它时,
工具栏
不会隐藏。同时,当我向上拖动
ImageView
工具栏时
隐藏。如何修复此问题?

您是否在回收器上启用了嵌套滚动

recylcer.nestedScrollingEnabled(true)

我有一个非常类似的问题,但我的回收器是垂直的,你可以在这里参考我的答案:

只需添加
recyclerView.setNestedScrollingEnabled(true)无法解决问题。也许我应该添加更多的内容?请看我提供的示例。我试图将OffsetChangeListener添加到AppBar,但当我拖动RecyclerView时,它没有启动,我认为这是因为RecyclerView方向的差异ToolBar隐藏在图像中,对吗?