Skip to content Skip to sidebar Skip to footer

Webview Not Showing Correctly

WebView is not showing website correctly. Any help would be great! The code ive used work on all another site. Not sure whats the issue. Any thing I should add? Works well in chrom

Solution 1:

A few suggestions:

Move loadUrl() after configuring your WebView (I noticed that in the comments, but it should be down there regardless).

It looks like the styles are missing from your page. Either they failed to load, or are somehow being disabled by the WebView. Try adding

myWebView.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT); and myWebView.getSettings().setDomStorageEnabled(true);

It also looks like the WebView is zoomed out: Try removing myWebView.getSettings().setUseWideViewPort(true); myWebView.getSettings().setLoadWithOverviewMode(true);

And FYI, you're not actually using MyWebViewClient for anything, and instead relying on the default WebViewClient.

Solution 2:

I don't know if this fixes the problem, but when you call loadUrl on a WebView the WebViewClient methods are invoked on a background thread. I don't think you can call UI stuff directly from a background thread. See How to start an activity from a thread class in android? for an example.

Post a Comment for "Webview Not Showing Correctly"