Skip to content Skip to sidebar Skip to footer

Android Setinitialscale Is Not Working For Mobile Pages

I am creating an application where I have to resize the content of a webview. Everything works fine until I load inside the webView a mobile page. No matter what value I set to set

Solution 1:

Have you tried :

DisplayMetrics metrics = new DisplayMetrics();
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;
}

Post a Comment for "Android Setinitialscale Is Not Working For Mobile Pages"