Skip to content Skip to sidebar Skip to footer

Android Webview Not Rendering Correctly On Ics 4.0 +

I have a problem with an Android app I am working on. I loaded a locally stored HTML into a WebView and set: webSettings.setLoadWithOverviewMode(true); webSettings.setUseWideViewP

Solution 1:

Give this a try:

DisplayMetricsmetrics=newDisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);

switch (metrics.densityDpi) {
case DisplayMetrics.DENSITY_HIGH:
    webView.getSettings().setDefaultZoom(WebSettings.ZoomDensity.FAR);
    break;

case DisplayMetrics.DENSITY_MEDIUM:
    webView.getSettings().setDefaultZoom(WebSettings.ZoomDensity.MEDIUM);
    break;

case DisplayMetrics.DENSITY_LOW:
    webView.getSettings().setDefaultZoom(WebSettings.ZoomDensity.CLOSE);
    break;

default:
    webView.getSettings().setDefaultZoom(WebSettings.ZoomDensity.MEDIUM);
    break;
}

See original post

OR Have you tried this?

WebViewwebview1= (WebView) findViewById(R.id.webview1);
webview1.setInitialScale(90);
webview1.loadUrl("http://stackoverflow.com");

Solution 2:

To me this looks more like a styling issue in your CSS code. Try playing around with the width sizes.

You might want to load a difference css for viewing it on a mobile device.

Post a Comment for "Android Webview Not Rendering Correctly On Ics 4.0 +"