There are some methods in WebSettings related to zoom:
- WebSettings.setSupportZoom
- WebSettings.setBuiltInZoomControls
I noticed they work differently on some devices.
For example, on my Galaxy S pinch to zoom is enabled by default, but on LG P500 it is disabled (And now I don't know how to enable ONLY pinch to zoom, but hide zooming buttons).
On P500 when I call setBuiltInZoomControls(true)
I get both these variants working (multitouch and buttons).
How to enable multitouch zoom and disable zooming buttons on devices such an LG P500? (Also, I know the same problems are on HTC devices)
UPDATE: Here is almost full code for the solution
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;
}
}
This code is in my onTouchEvent
overridden method of the WebView.
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…