问题
I use a popupwindow for displaying options in Android. I tried to dim/blur the activity when a popupwindow is active, but I did not find a solution... can anybody help me.
I used the following code but it does not work for me.
getWindow().addFlags(android.view.WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
回答1:
Use it like this:
WindowManager.LayoutParams lp = dialog.getWindow().getAttributes();
lp.dimAmount=0.0f;
dialog.getWindow().setAttributes(lp);
dialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
来源:https://stackoverflow.com/questions/8386410/how-to-blur-dim-an-activity-when-a-popup-window-is-shown-in-android