我正在实施 OnFling。它仅在速度非常高时起作用。这意味着我需要非常快速地移动我的手指,以便进行 Fling。这是代码:
SimpleOnGestureListener simpleOnGestureListener = new SimpleOnGestureListener() {
@Override
public boolean onDoubleTap(MotionEvent e) {
// TODO Auto-generated method stub
Log.v("onDoubleTap: \n", e.toString());
return super.onDoubleTap(e);
}
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
Log.v("on fling", "on fling");
if ((e1.getY() < CARD_POSITION) && (e2.getY() < CARD_POSITION)
&& (Math.abs(e1.getX() - e2.getX()) > CARD_SWIPE_MIN)){
return super.onFling(e1, e2, velocityX, velocityY);
} else {
return false;
}
}