Making the WebView
ignore motion events is the wrong way to go about it. What if the WebView
needs to hear about these events?
Instead subclass WebView
and override the non-private scroll methods.
public class NoScrollWebView extends WebView {
...
@Override
public boolean overScrollBy(int deltaX, int deltaY, int scrollX, int scrollY,
int scrollRangeX, int scrollRangeY, int maxOverScrollX,
int maxOverScrollY, boolean isTouchEvent) {
return false;
}
@Override
public void scrollTo(int x, int y) {
// Do nothing
}
@Override
public void computeScroll() {
// Do nothing
}
}
If you look at the source for WebView
you can see that onTouchEvent
calls doDrag
which calls overScrollBy.