Layout :
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
</FrameLayout>
<android.support.design.widget.CoordinatorLayout
android:id="@+id/bottom_sheet"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?colorPrimary"
app:behavior_hideable="false"
app:layout_behavior="@string/bottom_sheet_behavior"
tools:visibility="visible">
<android.support.v7.widget.RecyclerView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical"
android:nestedScrollingEnabled="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
app:elevation="0dp"
app:expanded="false">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="24dp"
android:layout_marginLeft="24dp"
android:layout_marginRight="32dp"
android:layout_marginTop="24dp"
android:gravity="center"
android:minHeight="36dp"
android:padding="8dp"
android:text="Sample text"
android:textColor="@android:color/holo_blue_bright"/>
</FrameLayout>
</android.support.design.widget.AppBarLayout>
</android.support.design.widget.CoordinatorLayout>
</android.support.design.widget.CoordinatorLayout>
Problem :
When the bottom sheet is EXPANDED
, the RecyclerView
scrolling works fine. But when it is COLLAPSED
, it is not possible to scroll to the bottom of the list. Some items are either cut off or not shown.
Solutions tried :
- Tried setting
setAutoMeasureEnabled
to true for theLayoutManager
. - Set
RecyclerView
height towrap_content
. - Put
RecyclerView
insideNestedScrollView
. - Used NestedCoordinatorLayout as the root.
Support Version : 26.1.0
Can someone help me here? Thanks.