Android class description-scroller

Source: Internet
Author: User

This article translated from: http://developer.android.com/reference/android/widget/Scroller.html

Inheritance relationship

Java. Lang. Object

|____ Android. widget. scroller

Class Overview

This class encapsulates rolling processing. In its constructor, you can pass the rolling duration and specify the maximum time required by the Rolling animation. During this period, the rolling processing will automatically move them to the final stage. If the computescroloffset () method always returns false, the rolling processing is complete.

Public Constructors

 

Scroller (context)

Create a scroler with the default period and the check-in)

 

Scroller (context, interpolator)

Use the specified plug-in to create a scroler ). If the parameters of the provisioner are null, the default plug-in (viscous plug-in) will be used ). The "flywheel" action for the honeycomb or updated application is valid.

 

Scroller (context, interpolator, Boolean flywheel)

Use the specified plug-in to create a scroler ). If the parameters of the provisioner are null, the default plug-in (viscous plug-in) will be used ). And specify whether the progressive "flywheel" behavior is supported.

 

Public Methods

Void

Abortanimation ()

Stop the animation. Unlike forcefinished (Boolean), terminating the animation will cause the scroll to move to the final position of X and Y.

Boolean

Computescroloffset ()

Call this method when you want to know the latest rolling position. If this method returns true, the animation is still in progress. The location is changed by the new location.

Void

Extendduration (INT extend)

Extend the scroll animation. Calling this method will make the animation scroll farther and longer than setting the setfinalx (INT) or setfinaly (INT) method.

Parameter: extend, in milliseconds, with an additional scroll time.

Void

Filing (INT startx, int starty, int velocity, int velocity, int Minx, int Maxx, int miny, int maxyy)

Start rolling processing based on the touch gesture. The scroll distance is determined based on the initial rate of the scroll.

Parameters:

Start Point of startx scrolling (X)

Start Point of starty rolling (y)

Velocityx, measured in pixels/second, measures the initial moving rate of the X axis.

Velocityy is measured in pixels per second. The initial fl speed of the Y axis is measured.

The smallest X-axis value of minx. The scroll cannot scroll through this point.

The maximum X-axis value of Maxx. The scroll cannot scroll through this point.

The smallest Y axis value of miny. The scroll cannot scroll through this point.

The maximum Y axis value of Maxy. The scroll cannot scroll through this point.

Final void

Forcefinished (Boolean finished)

Specify a special value for the finished field.

Parameter: Finished, specifying a new finished value.

Float

Getcurrvelocity ()

Returns the current rate.

Return Value: the initial rate minus the decreasing speed. The result can be a negative value.

Final int

Getcurrx ()

Returns the x-axis offset in the current scroll.

Return Value: The new X-axis offset is the absolute distance relative to the origin.

Final int

Getcurry ()

Returns the Y axis offset in the current scroll.

Return Value: The New Y axis offset is the absolute distance relative to the origin.

Final int

Getduration ()

Return the time required for rolling in milliseconds.

Return Value: the duration of rolling.

Final int

Getfinalx ()

Returns the position of the x-axis scroll end, which is only valid for the "Fling" type scroll.

Return Value: The final absolute offset distance from the X axis of the origin.

Final int

Getfinaly ()

Returns the position of the end of the Y-axis rolling, which is only valid for the "Fling" type rolling.

Return Value: The final absolute offset distance from the Y axis of the origin.

Final int

Getstartx ()

Returns the starting point of the X axis.

Return Value: the start point offset, which is the absolute distance from the X axis of the origin.

Final int

Getstarty ()

Returns the starting point of the Y axis.

Return Value: the start point offset, which is the absolute distance from the Y axis of the origin.

Final Boolean

Isfinised ()

Returns whether the rolling process of the scroll is complete.

Return Value: If the rolling process is completed, true is returned. Otherwise, false is returned.

Void

Setfinalx (INT newx)

Set the x-axis end point of the scroll.

Parameter: the absolute distance between the X axis of newx and the origin.

Void

Setfinaly (INT newy)

Set the end point of the Y axis of the scroll.

Parameter: absolute distance between newy and Y axes

Final void

Setfriction (float friction)

Sets the friction applied to the "Fling" gesture. Call the getscrollfriction () method to obtain the default value.

Parameter: Friction indicates the scalar scale value of the friction coefficient.

Void

Startscroll (INT startx, int starty, int dx, int Dy)

You can start the rolling process by providing the start point and stroke distance. The default value 250 ms is used for the rolling duration.

Parameters:

In pixels, startx sets the horizontal scroll offset, and the positive value will scroll to the left.

In pixels, starty sets the vertical scroll offset, and the positive value will scroll up the content.

DX horizontal travel. The positive value will scroll to the left

Dy vertical stroke. The positive value will scroll up the content

Void

Startscroll (INT startx, int starty, int dx, int dy, int duration)

Start the rolling process by providing the start point and stroke.

Parameters:

In pixels, startx sets the horizontal scroll offset, and the positive value will scroll to the left.

In pixels, starty sets the vertical scroll offset, and the positive value will scroll up the content.

DX horizontal travel. The positive value will scroll to the left

Dy vertical stroke. The positive value will scroll up the content

The duration is set in milliseconds.

Int

Timepassed ()

Returns the elapsed time after the rolling process starts.

Return Value: the time when the scrolling disappears, in milliseconds.

 

 

Related Article

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.