Hidden state of the Bottom Sheet

Nick picture Nick · Feb 9, 2017 · Viewed 14k times · Source

I am trying to set hidden state for BottomSheet, but it doesn't work. What's the problem?

 bottomBar = BottomSheetBehavior.from(findViewById(R.id.bottom_bar));
 bottomBar.setState(BottomSheetBehavior.STATE_HIDDEN);

Answer

zohaib khaliq picture zohaib khaliq · May 5, 2017

Remember to add this while hiding the bottom sheet at start of activity/fragment

bottomSheetBehavior =BottomSheetBehavior.from(bottom_sheet_view_here);
bottomSheetBehavior.setHideable(true);//Important to add
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);