I've got a GestureDetector.OnGestureListener hooked up to a ListView. I'm trying to listen for scroll events when the user is scrolling down:
private GestureDetector.OnGestureListener mOnGesture = new GestureDetector.OnGestureListener() {
@Override
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
}
}
But I see a very strange stream of "distanceY" values:
distanceY: -417.02252 // <-- huh?
e1: null
e2: MotionEvent{4097ac08 action=2 x=233.6657 y=417.02252 pressure=0.79999995 size=0.33333334}
distanceY: 1.5640259
e1: null
e2: MotionEvent{4097ac08 action=2 x=233.6657 y=415.4585 pressure=0.79999995 size=0.33333334}
distanceY: 1.5640259
e1: null
e2: MotionEvent{4097ac08 action=2 x=233.6657 y=413.89447 pressure=0.79999995 size=0.40000004}
... rest of values are positive, as expected ...
The first "distanceY" value is negative (unexpected), but then subsequent ones are all positive. What could explain this? I can reproduce this behavior each time.
Thanks
distanceY
is the distance between current and previous onScroll
event. Since this is the first such event I'm assuming it starts calculating from zero.
distanceY: ____-417.02252____ // Same value as...
e1: null
e2: MotionEvent{4097ac08 action=2 x=233.6657 y=____417.02252____ // ...here...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With