显示对话框时模糊/变暗背景窗口

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了显示对话框时模糊/变暗背景窗口相关的知识,希望对你有一定的参考价值。

  1. dialog = new AlertDialog.Builder(WordCube.this)
  2. .setTitle(WordCube.this.getResources().getString(R.string.app_name))
  3. .setMessage(s)
  4. .setIcon(R.drawable.logo)
  5. .setPositiveButton(R.string.btn_close, null)
  6. .show();
  7.  
  8. WindowManager.LayoutParams lp = dialog.getWindow().getAttributes(); // retrieves the windows attributes
  9.  
  10. lp.dimAmount=0.0f; // sets the dimming amount to zero
  11.  
  12. dialog.getWindow().setAttributes(lp); // sets the updated windows attributes
  13.  
  14. dialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND); // adds the flag to blur bg

以上是关于显示对话框时模糊/变暗背景窗口的主要内容,如果未能解决你的问题,请参考以下文章