Adjust recycler view height when persistent bottom sheet is expanded

android bottomsheet with recyclerview example
android change bottom sheet height
bottom sheet peek height
modal bottom sheet - android
android bottom sheet expand to full screen
android bottom sheet disable drag
recyclerview height wrap_content
custom bottom sheet dialog android example

I have a persistent bottom sheet (which is basically a button) and a recycler view both contained in a CoordinatorLayout.

When the bottom sheet is expanded, I do not want it to obscure the recycler view. I am able to achieve this by setting app:layout_insetEdge="bottom" in the bottom sheet and app:layout_dodgeInsetEdges="bottom" in the recycler view respectively.

However, since the recycler view's height is set to android:layout_height="match_parent", its top partly moves out of the screen when the bottom sheet is expanded.

Instead, I want the recycler view to adjust its height dynamically occording to the height of the bottom sheet so it does not move out of the screen anymore. How can I achieve that?

Here is the complete layout:

<?xml version="1.0" encoding="utf-8"?>

    app:layout_dodgeInsetEdges="bottom" />

    app:layout_behavior="" />


Edit: Screenshots added

Without the bottom sheet everything looks fine.

With the bottom sheet expanded the recycler view is not completely visible anymore.

Edit 2: GIF added

Android: Persistent bottom sheet peek covering last RecyclerView item, Faced the same issue recently, didn't find a better way than to remove app:​layout_dodgeInsetEdges="bottom" and use padding instead. This is how it can be  There are two types of bottom sheets, Persistent Bottom Sheet and Modal Bottom Sheet. > Persistent Bottom Sheet: The Persistent bottom sheet displays in-app content. It will be displayed at the bottom of the screen making some portion of the content visible. When activated it opens the full content. The elevation of the persistent bottom sheet is same as app making it part of the app. Below is the example of persistent bottom sheet of Google Maps app.

Android Bottom Sheet / Bottom Sheet Behavior, I have a persistent bottom sheet (which is basically a button) and a recycler view both contained in a CoordinatorLayout. When the bottom sheet is expanded,  STATE_COLLAPSED: Sets the bottom sheet height with the value set on the peekHeight attribute. STATE_DRAGGING: The bottom sheet is being dragged; STATE_EXPANDED: The bottom sheet is completely expanded; STATE_HIDDEN: The bottom sheet is completely hidden from the screen; Let’s jump onto the business end of this tutorial.

Try putting this attribute to the RecyclerView:


Making most out of Android Bottom Sheet - Mihir Patel, I have a persistent bottom sheet (which is basically a button) and a recycler view both contained in a CoordinatorLayout. When the bottom  In this tutorial we will learn, how to create a persistent bottom sheet, which we can drag up and down to show and hide its content. For the sheet we will use a NestedScrollView and set it’s layout_behavior to “BottomSheetBehavior” to tell the system that we want to use this NestedScrollView as our bottom sheet.

You can do 2 solutions
1 is to set top-margin to RecyclerView

Because your CoordinatorLayout is not aligning RecyclerView below Toolbar. So set top margin actionBarSize.

2 If you want RecyclerView comes up of Toolbar

Set android:elevation to RecyclerView because Toolbar has 4dp elevation, and above 21 version layouts are layered by elevation. So set


design_appbar_elevation value is 16dp.

Handling Scrolls with CoordinatorLayout · codepath/android_guides , I have implemented a persistent bottom sheet in my layout - one that But it covers the last RecyclerView item. How can I set the layout in such a way the peek doesn't hide the last item. RecyclerView android:paddingBottom="?dp" android:clipToPadding="false" /> replace "?dp" with the height of your  Android Bottom Sheet is a component that slides up from the bottom of the screen having multiple options. Here are the examples of the Bottom sheet from apps. After creating a new project, open…

Material Design / Bottom Sheets in Design Support Library , It has a littler height. Persistent Bottom Sheet. Modal Bottom Sheet: This botom sheet  Let’s add the first persistent bottom sheet to the layout. Designing the bottom sheet. A persistent bottom sheet is a part of the Activity view heirarchy.

Android Bottom Sheet Material Design with Example, Persistent bottom sheets: It can be implemented using BottomSheetBehavior in if you are using scrollview, dynamic views OR recyclerview in your fragment and contents When you don't have enough content to fit into EXPANDED state of a Which means, you can calculate the height of contents and set peekHeight of  If you are trying to adjust the peek height, I found I had to extend and override bottom sheet. In the below case, I get the height of my view set in the sheet, or use the maximum height.

Any scroll events to the RecyclerView should trigger changes to the Only when scrolling reaches to the top will the view expand to its full height: Now, we need to set the title on the CollapsingToolBarLayout instead of the Toolbar. Persistent bottom sheets show in-app content, while modal sheets  Bottom Sheet is the new material design widget and it is a simple bottom window display in the bottom of the screen. There have two type of Bottom Sheet which are Persistent and Modal. The first type Persistent Bottom Sheet is structural part of a User Interface and it is permanent in the activity, user can expand and collapse the view.