I use custom BottomSheetDialogFragment as the container for the Fragment that contains the EditText and RecyclerView.
The RecyclerView works fine until it reaches the upper border, at which point it doesn't stop (as it usually) but starts to close the BottomSheetDialogFragment
How do i fix this behavior?
BottomSheetDialogFragment begins to collapse when the RecyclerView reaches the top
layout_bottom_sheet.xml as layout for BottomSheetDialogFragment
<?xml version="1.0" encoding="utf-8"?>
<androidx.fragment.app.FragmentContainerView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</androidx.fragment.app.FragmentContainerView>
fragment_menu_search.xml as layout for BottomSheetDialogFragment @id/container
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<!!skip unnecessary!!>
<EditText
android:id="@+id/search_bar_text_view"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_marginStart="5dp"
android:layout_weight="1"
android:imeOptions="actionSearch" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_searched_dishes"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:clipToPadding="true"
android:paddingHorizontal="10dp"
android:paddingTop="10dp"
tools:itemCount="4"
tools:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:listitem="@layout/item_menu_search_dish"
tools:orientation="vertical" />
<!-- fill space -->
<View
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</layout>
I tried to override the ScrollListener of RecyclerView but it did not work