Scroller is a scroll that encapsulates the scrolling, enabling the view and viewgroup of the background canvas. It has two methods of construction: PublicScroller(context context)Pass a context.
PublicScroller(context context, interpolator interpolator)Pass a context, a custom scrolling method. Control the degree of speed.
The main methods of Scroller are:Public voidStartscroll(int startX, int starty, int dx, int dy, int duration)Public void startscroll (int startX, int starty, int dx, int dy) Starts scrolling, passing the start coordinate, and the displacement of the X y-axis. The first method is to refactor, and to pass the parameters of a scrolling time more.
Public Final intgetduration()Gets the time to scroll altogether. If you do not pass the motion time in, the default is 250ms
Public Final intGetcurrx()Public Final int getcurry () These two methods are literally understandable to get the current coordinates of X Y.
Public Final int getstartx () Public Final intGetstarty()Gets the x Y coordinate when the scroll starts
Public Final intGetfinalx()Public Final int getfinaly () Get the final x Y coordinate
Public voidFling(int startX, int starty, int velocityx, int velocityy, int minX, int maxX, int miny, int maxy)start scrolling on the fling (fast-sliding, user-pressed touch-screen, quick-move release) gesture. The distance to scroll depends on the initial speed of the fling.
Public Final Boolean isfinished () returns whether the scroller has completed scrolling.
public inttimepassed()How long has it been rolling?
public void extendduration (int extend)
Extend the scrolling animation time. This function allows the scrolling action to last longer and scroll longer distances when using setfinalx (int) or setfinaly (int) .
Parameters
extend scrolling event extension time, in milliseconds
See
setfinalx (int)
setfinaly (int)
Public final void forcefinished (Boolean finished)
Forces the terminating field to a specific value. (Translator Note: Stop scrolling now?) )
Parameters
finished New end value
public void abortanimation ()
stops the animation. in contrast to forcefinished (Boolean) ,Scroller scrolls to the final x with the stops the animation at the Y position.
See
Forcefinished (Boolean)
public boolean Computescrolloffset ()
This function is called when you want to know the new location. Returns true to indicate that the animation has not ended. Position changes to provide a new location.
Part reference:http://www.cnblogs.com/over140/archive/2010/12/16/1907528.html
From for notes (Wiz)
Scroller of Android API