Reputation: 4448
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"
/>
Upvotes: 17
Views: 11640
Reputation: 1428
It's also possible to set android:minHeight in xml file and it works fine for me.
<WebView
android:id="@+id/webView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="200dp"/>
Upvotes: 0
Reputation: 6569
It's also possible to set software
layer type in xml file and it works fine for me.
android:layerType="software"
Upvotes: 6
Reputation: 4463
To load Data from cache
webview.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
webview.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
webview.loadUrl(Your URL To Load);
Upvotes: 0
Reputation: 2044
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);
Upvotes: 1
Reputation: 4448
The solution is adding:
webview.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
webview.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
webview.getSettings().setRenderPriority(WebSettings.RenderPriority.HIGH);
Upvotes: 34