Strange flickering with WebView after setting android:hardwareAccelerated="true"
and mWebView.setBackgroundColor(Color.TRANSPARENT)
A no one, no flicker.
Strange flickering with WebView after setting android:hardwareAccelerated="true"
and mWebView.setBackgroundColor(Color.TRANSPARENT)
A no one, no flicker.
I have enabled the hardware acceleration for the application and have disabled it for the activity. Additionally I set the background to "null", as mentioned above. It works for me now. Another approach (untested): set the layer type to software rendering and set the background to Color.TRANSPARENT (or "0"): webview.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
Do not hard code the flag in code, it is not a best practice! you can enable the function in four levels。
Window level:
getWindow().setFlags(
WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
View Level:
myView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
Activity Level:
<application android:hardwareAccelerated="true">
<activity ... />
<activity android:hardwareAccelerated="false" />
</application>
Applecation Level:
<application android:hardwareAccelerated="true" ...>
ref http://developer.android.com/guide/topics/graphics/hardware-accel.html