Blurring/dimming background windows when dialog is displayed


/ Published in: Java
Save to your folder(s)



Copy this code and paste it in your HTML
  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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.