http://blog.sina.com.cn/s/blog_6c2210fd010109pf.html
(http://blog.jrj.com.cn/4586793646,5298605a.html)
用来追踪触摸事件(flinging事件和其他手势事件)的速率。用obtain()函数来获得类的实例,用addMovement(MotionEvent)函数将motion event加入到VelocityTracker类实例中,当你使用到速率时,使用computeCurrentVelocity(int)初始化速率的单位,并获得当前的事件的速率,然后使用getXVelocity() 或getXVelocity()获得横向和竖向的速率。
You can then retrieve the velocity with getXVelocity() and getYVelocity().
计算那些已经发生触摸事件点的当前速率。这个函数只有在你需要得到速率消息的情况下才调用,因为使用它需要消耗很大的性能。通过getXVelocity()和getYVelocity()获得横向和竖向的速率。
Parameters:
units The units you would like the velocity in. A value of 1 provides pixels per millisecond, 1000 provides pixels per second, etc.
maxVelocity The maximum velocity that can be computed by this method. This value must be declared in the same unit as the units parameter. This value must be positive.
参数:
具体使用方法:
大体的使用是:
用来跟踪触摸速度的类
当你需要跟踪的时候使用obtain()方法来来获得VelocityTracker类的一个实例对象
使用addMovement(MotionEvent)函数将当前的移动事件传递给VelocityTracker对象
使用 computeCurrentVelocity
使用 getXVelocity