Home » Android » android – Web view flicker/blinks while scrolling

android – Web view flicker/blinks while scrolling

Posted by: admin June 15, 2020 Leave a comment

Questions:

I am working on hybrid application, there are HTML5 files which i bundled within application. I need to play video on some HTML pages for that i used android:hardwareAccelerated="true" permission in manifest file.

But when i scroll webview it flicker/blinks the view.

Please let me know how to resolve this issue.

Thanks in advance.

How to&Answers:

Android web view Rendering Engine makes flickering usually. U can use some javascript mobile frameworks like JQMobi, Enyo js, JQuery Easing JS to solve this issue.

But what basically i experimented is html browser rendering always flickering in my case.

Answer:

I’ve added:

android:layerType="software"

to WebView, and it magically solved the problem.

Of course, left out hardware acceleration.

Answer:

It seems that the android:hardwareAccelerated=”true” is the root of the problem. If you really need it, you can solve this issue by calling:

webView.setLayerType(WebView.LAYER_TYPE_SOFTWARE, null);

It requires API level 11, so you can wrap it in a method like this:

@TargetApi(11)
protected void configureLayerType(WebView webView) {
    webView.setLayerType(WebView.LAYER_TYPE_SOFTWARE, null);
}