I have text preloaded in a webview. When the data from the internet comes, I reload the webview with the new data.
The problem is the screen blinks once during the load data transition.
Any advice?
Try to disable the hardware accelerator on the activity:
android:hardwareAccelerated="false"
In your Activity
LinearLayout.LayoutParams dfparams = new LinearLayout.LayoutParams(0,0, 0);
wedview.setLayoutParams(dfparams);
wedview.loadDataWithBaseURL(URL_SERVER, content, "text/html", "utf-8", null);
wedview.setWebViewClient(new WebViewClient() {
public void onPageFinished(WebView view, String url) {
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT, 0);
wedview.setLayoutParams(params);
}
});
In Your layout.xml
<LinearLayout
android:id="@+id/llSearch"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@null"
android:orientation="vertical" >
<WebView
android:id="@+id/wvContent"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:scrollbars="none" />
</LinearLayout>
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