Scroller of Android API

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.