简体   繁体   English

CoordinatorLayout内NestedScrollView内的RecyclerView

[英]RecyclerView inside NestedScrollView inside CoordinatorLayout

I have such layout: 我有这样的布局:

    <?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>

As you can see there are CoordinatorLayout with NestedScrollView inside it. 如您所见,其中包含带有NestedScrollView CoordinatorLayout And inside of the NestedScrollView there are horizontal RecyclerView . NestedScrollView内部有水平RecyclerView So this layout behaves as follows: 因此,此布局的行为如下: 如下

As one can see, problem is in RecyclerView . 可以看到,问题出在RecyclerView When I drag it up, Toolbar doesn't hide. 当我向上拖动它时, Toolbar不会隐藏。 In the same time when I dragging up the ImageView Toolbar hides. 同时,当我向上拖动时, ImageView Toolbar隐藏。 How to fix that? 如何解决?

did you enable nested scrolling on your recycler ? 您是否在回收站上启用了嵌套滚动?

recylcer.nestedScrollingEnabled(true)

I had a pretty similar problem, but my recycler was vertical, you can refer to my answer here : Here 我有一个非常相似的问题,但我的回收是垂直的,你可以参考我的答案在这里: 这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在CoordinatorLayout内部使用NestedScrollView,RecyclerView(水平)进行NestedScrolling - NestedScrolling with NestedScrollView, RecyclerView (Horizontal), inside a CoordinatorLayout NestedScrollView没有显示在CoordinatorLayout内部 - NestedScrollView not showing inside CoordinatorLayout RTL 水平 RecyclerView 在 CoordinatorLayout 的 NestedScrollView 内无法正常工作 - RTL Horizontal RecyclerView doesn't work properly inside a NestedScrollView in a CoordinatorLayout NestedScrollView内容未显示在CoordinatorLayout内 - NestedScrollView content not displaying inside CoordinatorLayout NestedScrollView 不在 CoordinatorLayout 内滚动 - Android - NestedScrollView not scrolling inside CoordinatorLayout - Android 具有CoordinatorLayout的NestedScrollView内的回收者视图 - Recycler view Inside NestedScrollView with CoordinatorLayout CoordinatorLayout 中的水平 RecyclerView - Horizontal RecyclerView inside CoordinatorLayout NestedScrollView smoothScroll内部的RecyclerView - RecyclerView inside NestedScrollView smoothScroll NestedScrollView中的RecyclerView的ScrollListener? - ScrollListener for RecyclerView inside NestedScrollView? NestedScrollView 内的 RecyclerView ScrollListener - RecyclerView ScrollListener inside NestedScrollView
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM