Android 在webview上缩放不起作用
当onTouchEvent发现zoom不工作时,我有一个扩展webview的类Android 在webview上缩放不起作用,android,android-webview,Android,Android Webview,当onTouchEvent发现zoom不工作时,我有一个扩展webview的类 @Override public boolean onTouchEvent(MotionEvent event) { super.cancelLongPress(); int action = event.getAction(); if (action == MotionEvent.ACTION_DOWN || action == MotionEvent.ACTION_
@Override
public boolean onTouchEvent(MotionEvent event) {
super.cancelLongPress();
int action = event.getAction();
if (action == MotionEvent.ACTION_DOWN
|| action == MotionEvent.ACTION_UP) {
super.onTouchEvent(event);
} else if (action == MotionEvent.ACTION_CANCEL
|| action == MotionEvent.ACTION_MOVE) {
MotionEvent e = MotionEvent.obtain(event);
e.setAction(MotionEvent.ACTION_CANCEL);
super.onTouchEvent(e);
}
gestureDetector.onTouchEvent(event);
super.cancelLongPress();
return true;
}
使用以下命令:
再加上
wv.getSettings().setSupportZoom(true);
wv.getSettings().setBuiltInZoomControls(true);
现在试试我的答案。两者相加