I read many tickets on the topic of Zooming in WebViews and didnt came to an answer for my case.
Here′s my setup:
I′m using a custom webview with generally these settings:
getSettings().setBuiltInZoomControls(false);
getSettings().setSupportZoom(false);
getSettings().setUseWideViewPort(true);
getSettings().setLoadWithOverviewMode(true);
Let me note right here that i depend on OverviewMode and as well on WideViewPort to Scale my WebView.
I′m also Overriding my OnTouchEvent and and delegate all suitable events to an Gesture detector:
@Override
public boolean onTouchEvent(MotionEvent event) {
if (gestureDetector.onTouchEvent(event)) return true;
return super.onTouchEvent(event);
}
Here is its listeners implementation which is intercepting all doubleTap events:
@Override
public boolean onDoubleTapEvent(MotionEvent e) {
// Do nothing!
return true;
}
@Override
public boolean onDoubleTap(MotionEvent e) {
// Do nothing!
return true;
}
@Override
public boolean onSingleTapConfirmed(MotionEvent e) {
// Do nothing!
return true;
}
Also i overrode these 2 WebView methods related to zoom:
@Override
public boolean zoomIn() {
return true;
}
@Override
public boolean zoomOut() {
return true;
}
Notherless of all these options a certain tap frequence will cause my webview to zoom in/out.
I havent found an option that disables this kind of zooming, the MotionEvent for this Zoom doesnt seem to be applicable for the GestureDetector and the override zoomIn() zoomOut() methods have no effect either.
Can anyone help me out with a way to avoid this double tap zoom behaivior of WebView?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…