Custom BottomSheet Behavior | More States | AndroidX

I want to be able to add more states to my current BottomSheet with multiple custom heights.

Right now, the AndroidX bottom sheet only has the following states: STATE_HIDDEN, STATE_HALF_EXPANDED, STATE_EXPANDED, STATE_COLLAPSED, STATE_DRAGGING, STATE_SETTLING.

Is there any way to add states/heights to the "BottomSheetBehavior" class?

Solutions I’ve considered:

  • There is a lot of material on this for the support version of the BottomSheet (and most of them stem from copy/pasting the code and modifying behavior) however almost none for the com.google.android.material.bottomsheet

  • I’ve considered extending the BottomSheetBehavior class and manually altering it’s behavior however this will take a lot of work/analysis to complete

Source: Android Questions

LEAVE A COMMENT