How do I maintain the Immersive Mode in Dialogs?

后端 未结 7 697
醉酒成梦
醉酒成梦 2020-11-28 01:14

How do I maintain the new Immersive Mode when my activities display a custom Dialog?

I am using the code below to maintain the Immersive Mode in Dialogs, but with th

7条回答
  •  星月不相逢
    2020-11-28 01:44

    Whean you are creating your own DialogFragment you need only override this method.

    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        Dialog dialog = super.onCreateDialog(savedInstanceState);
    
        dialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
                WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);
    
        return dialog;
    }
    

提交回复
热议问题