http://trinea.iteye.com/blog/1054786
1.OnGestureListener和OnDoubleTapListener
2.setOnTouchListener
3.重载onFling函数
4.OnFling的四个参数意思分别为
- e1 The first down motion event that started the fling.手势起点的移动事件
- e2 The move motion event that triggered the current onFling.当前手势点的移动事件
- velocityX The velocity of this fling measured in pixels per second along the x axis.每秒x轴方向移动的像素
- velocityY The velocity of this fling measured in pixels per second along the y axis.每秒y轴方向移动的像素
说的更简单点就是,鼠标手势相当于一个向量(当然有可能手势是曲线),e1为向量的起点,e2为向量的终点,velocityX为向量水平方向的速度,velocityY为向量垂直方向的速度
- if (e1.getX() - e2.getX() > verticalMinDistance && Math.abs(velocityX) > minVelocity)
则上面的语句能知道啥意思了吧,就是说向量的水平长度必须大于verticalMinDistance,并且水平方向速度大于minVelocity