美文网首页
Android通用Dialog属性,解决Dialog导致状态栏黑

Android通用Dialog属性,解决Dialog导致状态栏黑

作者: 饮料只喝芬达 | 来源:发表于2019-08-07 18:00 被阅读0次

    onCreate时设置style setStyle(DialogFragment.STYLE_NORMAL, android.R.style.Theme_Light_NoTitleBar);


    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
     Dialog dialog = super.onCreateDialog(savedInstanceState);
     dialog.setCanceledOnTouchOutside(true); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.getWindow().setBackgroundDrawableResource(R.color.transparent); dialog.getWindow().setWindowAnimations(R.style.DialogAnimation); dialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); dialog.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT); return dialog;
    }


    相关文章

      网友评论

          本文标题:Android通用Dialog属性,解决Dialog导致状态栏黑

          本文链接:https://www.haomeiwen.com/subject/bjpscctx.html