Android BottomSheet with RecyclerView

10,482

Solution 1

Also you can put the RecyclerView inside NestedScrollView.

Solution 2

Solved it. The problem was I added two RecyclerViews to the BottomSheet, and the second one didn't scroll in this case. I don't really need the first when and when I removed it, I was able to scroll the other.

Share:
10,482
user3057944
Author by

user3057944

Updated on June 11, 2022

Comments

  • user3057944
    user3057944 almost 2 years

    I added a BottomSheet with a RecyclerView in it to my app, but I can't scroll the RecyclerView, and I can't find out what is the problem.

    Here is my BottomSheet:

       <!-- bottom sheet -->
    <FrameLayout
       android:id="@+id/bottom_sheet"
       style="@style/Widget.Design.BottomSheet.Modal"
       android:layout_width="match_parent"
       android:layout_height="0dp"
       app:behavior_hideable="true"
       app:behavior_peekHeight="90dp"
       app:layout_behavior="@string/bottom_sheet_behavior">
    
        <!-- horizontal thumbnail -->
        <android.support.v7.widget.RecyclerView
           android:id="@+id/horizontal_thumbnail"
           android:layout_width="match_parent"
           android:layout_height="90dp"/>
    
        <!-- vertical thumbnail -->
        <android.support.v7.widget.RecyclerView
           android:id="@+id/vertical_thumbnail"
           android:layout_width="match_parent"
           android:layout_height="match_parent"
           android:visibility="gone"/>
    </FrameLayout>
    

    The vertical thumbnail is visible when the sheet is expanded, the horizontal is visible when the list is collapsed.