我有一个连接到 ListView 的 GestureDetector.OnGestureListener。当用户向下滚动时,我正在尝试监听滚动事件:
private GestureDetector.OnGestureListener mOnGesture = new GestureDetector.OnGestureListener() {
@Override
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
}
}
但我看到一个非常奇怪的“distanceY”值流:
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 ...
第一个“distanceY”值是负数(出乎意料),但随后的都是正数。这有什么可以解释的?我每次都可以重现这种行为。
谢谢