Just treat it like a BottomSheetDialog and just turn it off drag and drop or touch.
When creating a BottomSheetDialog , it will automatically pack your layout into the Layout Coordinator , so if you want to get a view from your view, call
final behavior BottomSheetBehavior = BottomSheetBehavior.from ((View) view.getParent ());
Then, with this behavior, you can do what you need.
final BottomSheetBehavior behavior = BottomSheetBehavior.from((View) view.getParent()); behavior.setHideable(false); behavior.setBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback() { @Override public void onStateChanged(@NonNull View bottomSheet, int newState) { } @Override public void onSlide(@NonNull View bottomSheet, float slideOffset) { behavior.setState(BottomSheetBehavior.STATE_EXPANDED); } });
It worked for me. Hope this helps.
source share