When a user clicks in an input field or textarea, the application zooms in. Is there a simple way to disable it?
Currently have the meta tag:
meta name="viewport" content="width=device-width; height=device-height; initial-scale=1.0; maximum-scale=1.0; user-scalable=no; target-densityDpi=device-dpi;"
Everything looks great till I look at it on a device with Android 2.2 Specifically HTC Evo 4G.
I messed around with this alot.
You have to have different solutions for different screen sizes and phones, done serverside.
This works for a HTC desire for instance:
<meta content='True' name='HandheldFriendly' />
<meta content='width=640px; initial-scale=0.50; maximum-scale=0.50;minimum-scale=0.50;' name='viewport' />
<meta name="viewport" content="width=640px" />
This is for an iphone:
<meta name="viewport" content="width=640px,user-scalable=0" />
webView.getSettings().setDefaultZoom(WebSettings.ZoomDensity.MEDIUM);
This method was deprecated in API level 19.
this works in the last android versions 4.4.2.
webView.setInitialScale(0);//default,no zoom
webView.getSettings().setSupportZoom(true);
webView.getSettings().setBuiltInZoomControls(true);
webView.getSettings().setLoadWithOverviewMode(false);
webView.getSettings().setUseWideViewPort(false);
webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With