I\'m using really naive code to show a bottom sheet dialog fragment:
class LogoutBottomSheetFragment : BottomSheetDialogFragment() {
override fun onCrea
I had the same problem. After looking into sources I found a workaround (a little bit hacky, but I found no alternatives).
public class YourDialog extends BottomSheetDialogFragment {
//your code
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
return new FitSystemWindowsBottomSheetDialog(getContext());
}
}
public class FitSystemWindowsBottomSheetDialog extends BottomSheetDialog {
public FitSystemWindowsBottomSheetDialog(Context context) {
super(context);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getWindow() != null && Build.VERSION.SDK_INT >= 21) {
findViewById(android.support.design.R.id.coordinator).setFitsSystemWindows(false);
findViewById(android.support.design.R.id.container).setFitsSystemWindows(false);
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS |
WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
}
}
}
And, finally, don't forget to add android:fitsSystemWindows="true" at the root of your dialog layout.
Hope it helps.