Pinch Zoom in webview [Android]

Roskvist picture Roskvist · Sep 29, 2010 · Viewed 11.7k times · Source

On my website, which is loaded in the webview, there is a map. There are also java scripts that detects double tap for zoom, dragging etc. But is it possible to have a javascript that detects the use of pinch zoom ? there are several examples of it working on an iphone, and on my website there is a script for the pinch zoom but it is only working on iphone.....

Is it possible to get it to work on Android ?

Thanks

Answer

Jesse Black picture Jesse Black · Nov 23, 2011

When you would like to scale web content in you WebView and enable pinch and zoom, I prefer the simple android way.

webView.getSettings().setBuiltInZoomControls(true);

and you can even hide the controls if you are using API 11 or higher

webView.getSettings().setDisplayZoomControls(false)