I am loading the data from a String, and on the first time when I scroll down the webview blinks couple of times.
Here is my code where I load the data:
webview.loadDataWithBaseURL(null, message.getmContent(), "text/html", "UTF-8", null);
And the xml:
<WebView
android:id="@+id/web_content"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@+id/footer"
android:layout_below="@id/message_title"
android:layout_margin="4dp"
/>
The solution is adding:
webview.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
webview.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
webview.getSettings().setRenderPriority(WebSettings.RenderPriority.HIGH);
It's also possible to set software
layer type in xml file and it works fine for me.
android:layerType="software"
After resolving with the above solution, My WebView autoFocused on scroll down. I resolved the flicker and auto-scroll by:
webView.setFocusable(false);
webView.setFocusableInTouchMode(false);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With