简体   繁体   中英

Scrolling RecycleView that is inside AppBarLayout disables scrollFlag when scrolling outer RecycleView

While i haven't touched the inner RecycleView, scrolling the outer RecycleView moves the content as desired, but after i have scrolled the inner RecycleView and then tried to scroll the outer RecycleView, the upper content doesn't move, only the outer RecycleView scrolls. HorizontalRecycleView is just a custom horizontal RecycleView.

Here is a simplified 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:background="@color/background"
    android:clickable="true">

    <android.support.v7.widget.RecyclerView //outer RecyclerView 
        android:id="@+id/bottom_recycle_view"
        android:layout_width="fill_parent"
        android:layout_height="match_parent"
        android:layout_gravity="bottom"            
        app:layout_behavior="@string/appbar_scrolling_view_behavior" />

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/transparent">
...


  <com.app.opticsplanet.views.recycleview.HorizontalRecycleView //inner RecyclerView
                android:id="@+id/top_recycle_view"
                android:layout_width="match_parent"
                android:layout_height="@dimen/brand_row_height"
                android:clipToPadding="false"
                android:paddingLeft="@dimen/default_margin" />
...
 </android.support.design.widget.AppBarLayout>

I found a answer. For the inner RecyclerView, that shouldn't influence the contents scrolling, you should set -

mInnerRecycleView.setNestedScrollingEnabled(false);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM