WebView Disable DoubleTap

你离开我真会死。 提交于 2019-12-11 08:06:08

问题


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);

回答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?




回答2:


add this

webView.getSettings().setUseWideViewPort(false);


来源:https://stackoverflow.com/questions/29106783/webview-disable-doubletap

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!