Window window = dialog.getWindow();if (window != null) {window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);window.getDecorView().setPadding(0, 0, 0, 0);window.getDecorView().setBackgroundColor(Color.WHITE);WindowManager.LayoutParams layoutParams = window.getAttributes();layoutParams.width = WindowManager.LayoutParams.MATCH_PARENT;layoutParams.height = WindowManager.LayoutParams.MATCH_PARENT;if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {WindowManager.LayoutParams lp = window.getAttributes();lp.layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;window.setAttributes(lp);final View decorView = window.getDecorView();decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);}window.setAttributes(layoutParams);}