Reputation: 91
I am loading a very small HTML content, which is stored in my assets folder. But the problem is that it blinks on the screen first and then shows the content. I searched for the problem, but found nothing good. My code is given below along with xml.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.dialog_nearby);
WebView wv;
wv = (WebView) findViewById(R.id.WebView);
wv.loadUrl("file:///android_asset/intro.html");
}
My XML
<WebView
android:id="@+id/WebView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
Upvotes: 0
Views: 2060
Reputation: 1904
The easiest way to fix your issue is to disable hardware acceleration http://developer.android.com/guide/topics/graphics/hardware-accel.html
webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
should disable hardware acceleration for the web view and do the trick.
You can also refer to this thread WebView "flashing" with white background if hardware acceleration is enabled (Android 3.0+) where people may also different solutions.
Upvotes: 1