Alternative to “FLAG_BLUR_BEHIND” in Android?

允我心安 提交于 2019-11-26 21:09:38

问题


I can see that when I use the same flag as shown on the API-demos for blurring the background, I get a warning that it's deprecated:

"The field WindowManager.LayoutParams.FLAG_BLUR_BEHIND is deprecated".

I've read about it, and I've found that "Blurring is no longer supported".

Does it mean that it won't work on future versions? Why did they deprecate it? Is there an alternative? I really like this feature.


回答1:


ok , there is probably no alternative that uses the API , unless maybe i've forgetting anything.

i can however use dimming , which is cool too, as written here:

WindowManager.LayoutParams lp = dialog.getWindow().getAttributes();  
lp.dimAmount=0.0f;  
dialog.getWindow().setAttributes(lp);  
dialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND);  



回答2:


watch out that

WindowManager.LayoutParams.FLAG_BLUR_BEHIND

is deprecated.. (at least at Android 4.0 it leads to a black screen in background...)

Reference (Source): http://developer.android.com/reference/android/view/WindowManager.LayoutParams.html

int FLAG_BLUR_BEHIND This constant is deprecated. Blurring is no longer supported.

public static final int FLAG_BLUR_BEHIND

Since: API Level 1
This constant is deprecated.
Blurring is no longer supported.

Window flag: blur everything behind this window.

Constant Value: 4 (0x00000004)

what a pitty .. :( (was a nice effect ;))




回答3:


I Think u should try ShowCaseView Library. For Highlighting the Elements on Android.

The ShowcaseView library is designed to highlight and showcase specific parts of apps to the user with a distinctive and attractive overlay. This library is great for pointing out points of interest for users, gestures, or obscure but useful items.

Github Link : https://github.com/amlcurran/ShowcaseView



来源:https://stackoverflow.com/questions/10372404/alternative-to-flag-blur-behind-in-android

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