2

I am developing an android application and successfully disabled zoom-in, zoom-out by swiping. But I have failed to disable double tap zooming. Is there an obvious function to use? Thanks.

Here is my code,

webview.getSettings().setJavaScriptEnabled(true);
webview.getSettings().setLoadWithOverviewMode(true);
webview.getSettings().setUseWideViewPort(true);
webview.getSettings().setBuiltInZoomControls(false);
webview.getSettings().setDisplayZoomControls(false);
webview.getSettings().setSupportZoom(false);
webview.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
webview.loadUrl(url1);

2 Answers2

4

add this

webView.getSettings().setUseWideViewPort(false);
Harish
  • 576
  • 1
  • 8
  • 21
1

Unfortunately, it's a "feature" in WebView in pre-KitKat versions of Android, that double tap can be explicitly disabled only by turning off UseWideViewPort setting.

There are workarounds that based on "stealing" double tap events from WebView described in WebView getting rid of double tap zoom. and How to disable doubletap zoom in android webview?

Community
  • 1
  • 1
Mikhail Naganov
  • 6,643
  • 1
  • 26
  • 26