Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Scroller( Context context)
Create a Scroller with the default duration and interpolator.
|
|||||||||||
Scroller( Context context, Interpolator interpolator)
Create a Scroller with the specified interpolator.
interpolator参数只是在
computeScrollOffset()函数中用于
对我们的流逝的时间(通过
timePassed()取得
)这值进行重新解析
|
|||||||||||
Scroller( Context context, Interpolator interpolator, boolean flywheel)
Create a Scroller with the specified interpolator.
interpolator只是在
computeScrollOffset()函数中用于
对我们的流逝的时间(通过
timePassed()取得
)这值进行重新解析
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void | abortAnimation()
Stops the animation.
停止scroll
|
||||||||||
boolean | computeScrollOffset()
Call this when you want to know the new location.
计算scroll的情况
|
||||||||||
void | extendDuration(int extend)
Extend the scroll animation.
增加scroll的时间
|
||||||||||
void | fling(int startX, int startY, int velocityX, int velocityY, int minX, int maxX, int minY, int maxY)
Start scrolling based on a fling gesture.
模拟fling形式的scroll行为。
int startX, int startY代表起点,
int velocityX, int velocityY代表初速度,
int minX, int maxX, int minY, int maxY代表终点的范围
|
||||||||||
final void | forceFinished(boolean finished)
Force the finished field to a particular value.
强制设置为scroll状态
|
||||||||||
float | getCurrVelocity()
Returns the current velocity.
得到当前速度。该值是
X方向和
Y方向的合成值
|
||||||||||
final int | getCurrX()
Returns the current X offset in the scroll.
得到当前的X坐标
|
||||||||||
final int | getCurrY()
Returns the current Y offset in the scroll.
得到当前的Y坐标
|
||||||||||
final int | getDuration()
Returns how long the scroll event will take, in milliseconds.
得到设置的scroll行为的总时间值
|
||||||||||
final int | getFinalX()
Returns where the scroll will end.
得到scroll行为终点的X值
|
||||||||||
final int | getFinalY()
Returns where the scroll will end.
得到scroll行为终点的Y值
|
||||||||||
final int | getStartX()
Returns the start X offset in the scroll.
得到scroll行为起点的X值
|
||||||||||
final int | getStartY()
Returns the start Y offset in the scroll.
得到scroll行为起点的Y值
|
||||||||||
final boolean | isFinished()
Returns whether the scroller has finished scrolling.
返回scroll行为是否结束
|
||||||||||
void | setFinalX(int newX)
Sets the final position (X) for this scroller.
设置scroll行为的终点的X值
|
||||||||||
void | setFinalY(int newY)
Sets the final position (Y) for this scroller.
设置scroll行为的终点的Y值
|
||||||||||
final void | setFriction(float friction)
The amount of friction applied to flings.
|
||||||||||
void | startScroll(int startX, int startY, int dx, int dy)
Start scrolling by providing a starting point and the distance to travel.
设置一个scrolling行为模型,即在
int duration
(单位为毫秒)
时间的内从
int startX, int startY,
这个点起向X和Y方向分别滚动
int dx
和
int dy
个像素
|
||||||||||
void | startScroll(int startX, int startY, int dx, int dy, int duration)
Start scrolling by providing a starting point and the distance to travel.
设置一个scrolling行为模型,即在默认
时间(250毫秒)内从
int startX, int startY,
这个点起向X和Y方向分别滚动
int dx
和
int dy
个像素
|
||||||||||
int | timePassed()
Returns the time elapsed since the beginning of the scrolling.
取得从scroll开始到现在已经失去的时间
|