Activity blur causes lag
-
22-10-2019 - |
문제
Just a quick question. My app uses a transparent activity with a style applied as follows:
<style name="Theme.PopupWindow" parent="android:Theme">
<item name="android:windowFrame">@null</item>
<item name="android:windowTitleStyle">@android:style/Widget.PopupWindow</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
<item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
</style>
In the activity class, I call the following line of code before setContentView():
getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
Although this works, I find it lags considerably when I launch the activity. Using another flag such as FLAG_DIM_BEHIND executes perfectly smooth. Is this a known issue, or am I just attempting this incorrectly?
Thanks.
해결책
Blurring is a relatively CPU-intensive effect. It's not uncommon for it to cause lag especially on older devices.
제휴하지 않습니다 StackOverflow