Почему прокрутка Two RecyclerView внутри макета с BottomSheetBehavior не работает?

У меня есть макет с BottomSheetBehavior. Я использую ConstraintLayout, внутри макета у меня есть два RecyclerView, прежде чем у двух из них прокрутка RecyclerView работает отлично, как только я добавляю второй RecyclerView, который содержит довольно небольшой контент, максимум 3 строки, прокрутка второй RecyclerView отключен, и когда я меняю первый RecyclerView на простой LinearLayout, он тоже работает. Примечание: содержимое firstRecyclerview довольно маленькое, его не нужно прокручивать, только второе.

 <android.support.constraint.ConstraintLayout
        android:id="@+id/store_bottom_sheet"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginBottom="@dimen/bottom_navigation_height"
        android:background="@android:color/transparent"
        android:fitsSystemWindows="true"
        app:behavior_hideable="false"
        app:behavior_peekHeight="350dp"
        app:layout_behavior="@string/bottom_sheet_behavior">


        <android.support.constraint.ConstraintLayout
            android:id="@+id/constraintLayout"
            android:layout_width="0dp"
            android:layout_height="60dp"
            android:layout_marginTop="8dp"
            android:background="@drawable/rounded_shape"
            app:layout_constraintHorizontal_bias="0.0"
            app:layout_constraintLeft_toLeftOf="parent"
            app:layout_constraintRight_toRightOf="parent"
            app:layout_constraintTop_toTopOf="parent">

 <ImageView
                android:id="@+id/imageView"
                android:layout_width="19dp"
                android:layout_height="23dp"
                android:layout_marginStart="16dp"
                android:layout_marginTop="19dp"
                app:layout_constraintLeft_toLeftOf="parent"
                app:layout_constraintTop_toTopOf="parent"
                app:srcCompat="@drawable/ic_search"/>
 </android.support.constraint.ConstraintLayout>

  <android.support.v7.widget.RecyclerView
                android:id="@+id/list_filter"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                app:adapter="@{viewModel.filterAdapter}"
                   app:layout_constraintLeft_toLeftOf="parent"
            app:layout_constraintRight_toRightOf="parent"
          app:layout_constraintTop_toBottomOf="@+id/constraintLayout"/>


 <android.support.v7.widget.RecyclerView
            android:id="@+id/recyclerView2"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_marginTop="8dp"
            android:nestedScrollingEnabled="true"
            app:adapter="@{viewModel.findStoresAdapter}"
            app:dividerDrawable="@{@drawable/vertical_divider}"
         app:layoutManager="android.support.v7.widget.LinearLayoutManager"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintHorizontal_bias="0.0"
            app:layout_constraintLeft_toLeftOf="parent"
            app:layout_constraintRight_toRightOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/list_filter"
            app:layout_constraintVertical_bias="0.0"/>
</android.support.constraint.ConstraintLayout>

person I.S    schedule 02.06.2017    source источник
comment
вы можете использовать в CoordinatorLayout, проверьте эту ссылку   -  person Rasoul Miri    schedule 11.10.2017


Ответы (1)


Потому что два RecyclerViews, прокручиваемые в одном направлении, конфликтуют друг с другом. Используйте один RecyclerView с разными ViewTypes.

person Anton Kazakov    schedule 02.06.2017