Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Background blur while using dialog box

Tags:

android

I want the background behind the dialog box to be blurry. I used this code but it black outs the whole background instead of blur

dialog = new Dialog(context,R.style.Theme_Dialog_Translucent);

    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
like image 794
user1169079 Avatar asked Feb 22 '26 22:02

user1169079


1 Answers

Try it like this instead:

WindowManager.LayoutParams lp = dialog.getWindow().getAttributes();
lp.dimAmount=0.0f;
dialog.getWindow().setAttributes(lp);
dialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
like image 87
adneal Avatar answered Feb 24 '26 11:02

adneal



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!