How to blur/dim an activity when a popup window is shown in android

限于喜欢 提交于 2020-01-02 05:46:09

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!