Search code examples
androidkotlinbottom-sheetandroid-motionlayoutandroid-bottomsheetdialog

How to set views in BottomSheetDialog for different state STATE_EXPANDED and STATE_COLLAPSED?


I have single layout with title, 3 items and button. I need to set just title, 1 item and button if state is STATE_COLLAPSED and all views fo STATE_EXPANDED. How I must to do this?


Solution

  • set View.Visibile when bottomsheetis expanded and View.GONE when bottomsheetis callpsed. More code would be nice.

    use bottomSheetBehavior.setBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback()and override the onStateChanged method.

    States of bottomsheetbehavior has state methods of the bottomsheetdialog