WebView禁用DoubleTap [英] WebView Disable DoubleTap
问题描述
我正在开发一个android应用程序,并通过滑动成功禁用了放大,缩小.但是我无法禁用双击缩放. 有明显的功能要使用吗? 谢谢.
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.
这是我的代码,
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);
推荐答案
不幸的是,这是Android KitKat之前版本中WebView的功能",只有关闭UseWideViewPort
设置才能明确禁用双击.
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.
有些变通办法是基于 WebView摆脱了双击缩放.和如何禁用Android WebView中的双击缩放?
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?
这篇关于WebView禁用DoubleTap的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!