I've looked at the source code for WebView
and I concluded that there is no elegant way to accomplish what you are asking.
What I ended up doing was subclassing WebView
and overriding OnTouchEvent
.
In OnTouchEvent
for ACTION_DOWN
, I check how many pointers there are using MotionEvent.getPointerCount()
.
If there is more than one pointer, I call setSupportZoom(true)
, otherwise I call setSupportZoom(false)
. I then call the super.OnTouchEvent().
This will effectively disable zooming when scrolling (thus disabling the zoom controls) and enable zooming when the user is about to pinch zoom. Not a nice way of doing it, but it has worked well for me so far.
Note that getPointerCount()
was introduced in 2.1 so you'll have to do some extra stuff if you support 1.6.