放大webview不起作用

时间:2013-09-12 12:58:06

标签: android android-webview

我发现类扩展了webview,当发现onTouchEvent时缩放不起作用。

@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;
}

1 个答案:

答案 0 :(得分:0)

使用此: 添加它

wv.getSettings().setSupportZoom(true);
wv.getSettings().setBuiltInZoomControls(true);