BottomSheetBehavior с фрагментами - PullRequest
0 голосов
/ 23 октября 2019

Мне нужна помощь с перекрытием прокрутки

У меня есть вид:

<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.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">

    <!-- some content -->

    <androidx.appcompat.widget.ContentFrameLayout
        android:id="@+id/mainBottomSheet"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/bottom_sheet_behavior" />

</androidx.coordinatorlayout.widget.CoordinatorLayout>

Затем я добавляю фрагмент, который содержит обзор переработчика в mainBottomSheet

// setup peekHeight, state, register the BottomSheetCallback

supportFragmentManager
    .beginTransaction()
    .add(R.id.mainBottomSheet, FragmentA())
    .addToBackStack(null)
    .commit()

Все работает хорошо. Пользователь проведите вверх и вниз. Содержимое внутри RecyclerView также будет нормально прокручиваться

Теперь проблема пришла. Я добавляю FragmentB. Но свиток от FragmentA продолжает работать

supportFragmentManager
    .beginTransaction()
    .add(R.id.mainBottomSheet, FragmentB())
    .addToBackStack(null)
    .commit()
...