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 setInitialScale(n)
the content of webView is not resizing. Below is the code I am using:
webView.getSettings().setSupportZoom(true);
webView.getSettings().setUseWideViewPort(true);
webView.setInitialScale(33);
webView.loadUrl("http://m.jurnalul.ro");
Is there any possibility to zoom out or in the content of a WebView that contains a mobile page.
Thank you very much
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;
}