如何停止在android for HTC中放大webview的网页

如何停止在android for HTC中放大webview的网页,android,webview,zooming,htc-android,Android,Webview,Zooming,Htc Android,当点击输入文本时,如何停止在android中放大HTC mobiles的webview网页。如有任何建议,将不胜感激 if (ev.getAction() == MotionEvent.ACTION_DOWN || ev.getAction() == MotionEvent.ACTION_POINTER_DOWN || ev.getAction() == MotionEvent.ACTION_POINTER_1_DOWN || ev.getActi

当点击输入文本时,如何停止在android中放大HTC mobiles的webview网页。如有任何建议,将不胜感激

if (ev.getAction() == MotionEvent.ACTION_DOWN ||
        ev.getAction() == MotionEvent.ACTION_POINTER_DOWN ||
        ev.getAction() == MotionEvent.ACTION_POINTER_1_DOWN ||
        ev.getAction() == MotionEvent.ACTION_POINTER_2_DOWN ||
        ev.getAction() == MotionEvent.ACTION_POINTER_3_DOWN) {
    if (multiTouchZoom && !buttonsZoom) {
        if (getPointerCount(ev) > 1) {
            getSettings().setBuiltInZoomControls(true);
            getSettings().setSupportZoom(true);
        } else {
            getSettings().setBuiltInZoomControls(false);
            getSettings().setSupportZoom(false);
        }
    }
}

if (!multiTouchZoom && buttonsZoom) {
    if (getPointerCount(ev) > 1) {
        return true;
    }
}

}

最后,我观察到HTC定制了android操作系统,我们的webview设置在那里根本不起作用。虽然我已经定制了webview,但没有任何用处。我用另一种方式解决我的问题


它在webview zoom中只有“远”、“近”和“中”设置。这已设置。但我们可以在mobile的设置中更改它们。除此之外,我们不能更改任何内容。

检查此webview.getSettings().setUseWideViewPort(false);我已经查过了。但该代码在HTC手机中不起作用。因为我认为HTC已经对web视图进行了某些自定义,所以我们的缩放选项在那里不起作用;即使上面的代码也经过了测试,但那是没有用的
public class HelpWebView extends WebView {

private GestureDetector gestureDetector;
private AtomicBoolean mPreventAction = new AtomicBoolean(false);
private AtomicLong mPreventActionTime = new AtomicLong(0);

public HelpWebView(Context context) {
    super(context);
    gestureDetector = new GestureDetector(context, new GestureListener());
}

public HelpWebView(Context context, AttributeSet attrs) {
    super(context, attrs);
    gestureDetector = new GestureDetector(context, new GestureListener());
}

public HelpWebView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    gestureDetector = new GestureDetector(context, new GestureListener());
}

public HelpWebView(Context context, AttributeSet attrs, int defStyle, boolean privateBrowsing) {
    super(context, attrs, defStyle, privateBrowsing);
    gestureDetector = new GestureDetector(context, new GestureListener());
}

@Override
public boolean onTouchEvent(MotionEvent event) {
    int index = (event.getAction() & MotionEvent.ACTION_POINTER_INDEX_MASK) >> MotionEvent.ACTION_POINTER_INDEX_SHIFT;
    int pointId = event.getPointerId(index);

    // just use one(first) finger, prevent double tap with two and more fingers
    if (pointId == 0){
        gestureDetector.onTouchEvent(event);

        if (mPreventAction.get()){
            if (System.currentTimeMillis() - mPreventActionTime.get() > ViewConfiguration.getDoubleTapTimeout()){
                mPreventAction.set(false);
            } else {
                return true;
            }
        }

        return super.onTouchEvent(event);
    } else {
        return true;
    }
}

private class GestureListener extends GestureDetector.SimpleOnGestureListener {
    @Override
    public boolean onDoubleTap(MotionEvent e) {
        mPreventAction.set(true);
        mPreventActionTime.set(System.currentTimeMillis());
        return true;
    }
    @Override
    public boolean onDoubleTapEvent(MotionEvent e) {
        mPreventAction.set(true);
        mPreventActionTime.set(System.currentTimeMillis());
        return true;
    }
}