My onScroll and areonTouchEvent getting called, but not the onDown method. In fact, when I log the distaceX in onDown I get several of them logged out, and the first is always relative to the spot where I ended the last scroll.
@Override
public boolean onTouchEvent(MotionEvent me){
this.detector.onTouchEvent(me);
return super.onTouchEvent(me);
}
@Override
public boolean onDown(MotionEvent e) {
Log.d("---onDown---",".");
return false;
}
@Override
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX,
float distanceY) {
Log.d("---onScroll---", "" + distanceX);
return false;
}
Any ideas why onDown would not be called?
EDIT:
I changed my onTouchEvent to the following block, and only the ACTION_MOVE gets logged.
float gestureDistance = 0;
@Override
public boolean onTouchEvent(MotionEvent me){
switch (me.getAction() & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_DOWN:
Log.d("actionDown", "gestureDistance:" + gestureDistance);
break;
case MotionEvent.ACTION_UP:
Log.d("actionUp", "gestureDistance:" + gestureDistance);
break;
case MotionEvent.ACTION_MOVE:
Log.d("actionMove", "gestureDistance:" + gestureDistance);
break;
default:
Log.d("action default", "default");
break;
}
EDIT:
I think the problem is that my view is a WebView. Can I keep the webview from stealing my events?
Adding this to my
onCreatefixed the problem.