Android Bottom Sheets Persistent Bottom Sheets


You can achieve a Persistent Bottom Sheet attaching a BottomSheetBehavior to a child View of a CoordinatorLayout:

< >

    <!-- .....   -->


           <!-- .....   -->



Then in your code you can create a reference using:

 // The View with the BottomSheetBehavior  
 View bottomSheet = coordinatorLayout.findViewById(;  
 BottomSheetBehavior mBottomSheetBehavior = BottomSheetBehavior.from(bottomSheet);  

You can set the state of your BottomSheetBehavior using the setState() method:


You can use one of these states:

  • STATE_COLLAPSED: this collapsed state is the default and shows just a portion of the layout along the bottom. The height can be controlled with the app:behavior_peekHeight attribute (defaults to 0)

  • STATE_EXPANDED: the fully expanded state of the bottom sheet, where either the whole bottom sheet is visible (if its height is less than the containing CoordinatorLayout) or the entire CoordinatorLayout is filled

  • STATE_HIDDEN: disabled by default (and enabled with the app:behavior_hideable attribute), enabling this allows users to swipe down on the bottom sheet to completely hide the bottom sheet

If you’d like to receive callbacks of state changes, you can add a BottomSheetCallback:

mBottomSheetBehavior.setBottomSheetCallback(new BottomSheetCallback() {  
    public void onStateChanged(@NonNull View bottomSheet, int newState) {  
      // React to state change  
      public void onSlide(@NonNull View bottomSheet, float slideOffset) {  
       // React to dragging events