翻译自:http://developer.android.com/reference/android/view/VelocityTracker.html 参照自: http://blog.jrj.com.cn/4586793646,5298605a.html
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void | addMovement( MotionEvent event)
Add a user's movement to the tracker.
|
||||||||||
void | clear()
Reset the velocity tracker back to its initial state.
|
||||||||||
void | computeCurrentVelocity(int units, float maxVelocity)
Compute the current velocity based on the points that have been collected.
int unitis表示速率的基本时间单位。unitis值为1的表示是,一毫秒时间单位内运动了多少个像素, unitis值为1000表示一秒(1000毫秒)时间单位内运动了多少个像素
floatVelocity表示速率的最大值
|
||||||||||
void | computeCurrentVelocity(int units)
Equivalent to invoking computeCurrentVelocity(int, float) with a maximum velocity of Float.MAX_VALUE.
|
||||||||||
abstract T | getNextPoolable() | ||||||||||
float | getXVelocity()
Retrieve the last computed X velocity.
|
||||||||||
float | getXVelocity(int id)
Retrieve the last computed X velocity.
|
||||||||||
float | getYVelocity(int id)
Retrieve the last computed Y velocity.
|
||||||||||
float | getYVelocity()
Retrieve the last computed Y velocity.
|
||||||||||
abstract boolean | isPooled() | ||||||||||
static VelocityTracker | obtain()
Retrieve a new VelocityTracker object to watch the velocity of a motion.
|
||||||||||
void | recycle()
Return a VelocityTracker object back to be re-used by others.
|
||||||||||
abstract void | setNextPoolable(T element) | ||||||||||
abstract void | setPooled(boolean isPooled) |