How do you set the state of a fragment extending BottomSheetDialogFragment
to expanded using BottomSheetBehavior#setState(STATE_EXPANDED)
using the Android Support Design Library (v23.2.1)?
https://code.google.com/p/android/issues/detail?id=202396 says:
Bottom sheets are set to STATE_COLLAPSED at first. Call BottomSheetBehavior#setState(STATE_EXPANDED) if you want to expand it. Note that you cannot call the method before view layouts.
The suggested practice requires a view to be inflated first, but I'm not sure how I'll set the BottomSheetBehaviour onto a fragment (BottomSheetDialogFragment
).
View bottomSheet = coordinatorLayout.findViewById(R.id.bottom_sheet);
BottomSheetBehavior behavior = BottomSheetBehavior.from(bottomSheet);
I wrote a subclass of
BottomSheetDialogFragment
to handle this:}
So extend this class instead of
BottomSheetDialogFragment
to create your own bottom sheet.