A handy CoordinatorLayout that works well when used in a bottom sheet, even with AppBarLayouts inside.
CoordinatorLayoutthat works well when used in a bottom sheet, even with
Having issues with android.support v28? Please try
BottomSheetCoordinatorLayoutas the root view of your bottom sheet. It will be automatically given the right
<!-- AppBarLayout --> <!-- Everything else -->
To get an instance of the behavior, use
bscl.getBehavior(). As usual with behaviors, the returned value might be null if the view has not gone through a layout, so wait for that.
If you just want to set appropriate
BottomSheetCallback, you can use
bscl.setBottomSheetCallback(). Callbacks will be added to the sheet behavior as soon as it is available, so this can be called safely whenever you want. Same goes for other set() methods: they will apply the result to the behavior as soon as it is available.
You are welcome to contribute with issues, PRs or suggestions. To contact me, send an email.