I\'m using really naive code to show a bottom sheet dialog fragment:
class LogoutBottomSheetFragment : BottomSheetDialogFragment() {
override fun onCrea
In BottomSheetDialogFragment, the only thing that needs to be done is to set the container of the underlying CoordinatorLayout fitSystemWindows to false.
override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
(view!!.parent.parent.parent as View).fitsSystemWindows = false
}
view is your layoutview.parent is a FrameLayout containing your viewview.parent.parent is the CoordinatorLayoutview.parent.parent.parent is the container for CoordinatorLayout which has its fitsSystemWindow set to true by default.This ensures that the whole BottomSheetDialogFragment is drawn underneath the navigation bar. Then you can set the fitsSystemWindows to your own containers accordingly.
What you don't need from the other answers in particular is:
getWindow() or getDialog(),This solution works with BottomSheetDialogFragment created with onCreateView, I did not check onCreateDialog.