问题描述
如何禁用doubletap放大的android 的WebView
。我已经尝试了很多东西,但都没有奏效。请给我建议合适的解决方案来实现这一目标。
How to disable the doubletap zoom in android webview
. I have tried many things but it haven't worked. Please suggest me the right solution to achieve this .
其实我加载从自定义HTML的图像。我必须禁用完全变焦为。
Actually I am loading an image from custom html . I have to disable complete zooming for that.
我曾尝试下面的东西,
webview.getSettings().setSupportZoom(false);
甚至我在HTML保持meta标签,我让它为 userscalable =没有
。即使它并没有为我工作。
and even I kept meta tag in html and I make it as userscalable= no
. Even it doesn't worked for me.
和我尝试使用 GestureDetector.SimpleOnGestureListener
请让我知道,我必须在规模 onDoubleTap
东西。
Please let me know that i have to scale anything in onDoubleTap
.
推荐答案
覆盖
的的onTouchEvent
在的WebView
。
它适用于所有情况。
Override
the onTouchEvent
in your WebView
.
It works in all cases.
@Override
public boolean onTouchEvent( MotionEvent event ) {
if (event.getAction() == MotionEvent.ACTION_UP) {
event.setAction(MotionEvent.ACTION_CANCEL);
super.onTouchEvent(event);
event.setAction(MotionEvent.ACTION_DOWN);
super.onTouchEvent(event);
event.setAction(MotionEvent.ACTION_UP);
}
return super.onTouchEvent(event);
}
这篇关于如何禁用doubletap放大的Android的WebView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!