java.lang.Object | |
↳ | android.widget.Scroller |
This class encapsulates scrolling. The duration of the scroll can be passed in the constructor and specifies the maximum time that the scrolling animation should take. Past this time, the scrolling is automatically moved to its final stage and computeScrollOffset() will always return false to indicate that scrolling is over.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Create a Scroller with the default duration and interpolator.
| |||||||||||
Create a Scroller with the specified interpolator.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Call this when you want to know the new location.
| |||||||||||
Extend the scroll animation.
| |||||||||||
Start scrolling based on a fling gesture.
| |||||||||||
Force the finished field to a particular value.
| |||||||||||
Returns the current X offset in the scroll.
| |||||||||||
Returns the current Y offset in the scroll.
| |||||||||||
Returns how long the scroll event will take, in milliseconds.
| |||||||||||
Returns where the scroll will end.
| |||||||||||
Returns where the scroll will end.
| |||||||||||
Returns the start X offset in the scroll.
| |||||||||||
Returns the start Y offset in the scroll.
| |||||||||||
Returns whether the scroller has finished scrolling.
| |||||||||||
Start scrolling by providing a starting point and the distance to travel.
| |||||||||||
Start scrolling by providing a starting point and the distance to travel.
| |||||||||||
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class java.lang.Object
|
Create a Scroller with the default duration and interpolator.
Create a Scroller with the specified interpolator. If the interpolator is null, the default (viscous) interpolator will be used.
Call this when you want to know the new location. If it returns true, the animation is not yet finished. loc will be altered to provide the new location.
Extend the scroll animation. This allows a running animation to scroll further and longer, when used with setFinalX() or setFinalY().
extend | Additional time to scroll in milliseconds. |
---|
Start scrolling based on a fling gesture. The distance travelled will depend on the initial velocity of the fling.
startX | Starting point of the scroll (X) |
---|---|
startY | Starting point of the scroll (Y) |
velocityX | Initial velocity of the fling (X) measured in pixels per second. |
velocityY | Initial velocity of the fling (Y) measured in pixels per second |
minX | Minimum X value. The scroller will not scroll past this point. |
maxX | Maximum X value. The scroller will not scroll past this point. |
minY | Minimum Y value. The scroller will not scroll past this point. |
maxY | Maximum Y value. The scroller will not scroll past this point. |
Force the finished field to a particular value.
finished | The new finished value. |
---|
Returns the current X offset in the scroll.
Returns the current Y offset in the scroll.
Returns how long the scroll event will take, in milliseconds.
Returns where the scroll will end. Valid only for "fling" scrolls.
Returns where the scroll will end. Valid only for "fling" scrolls.
Returns the start X offset in the scroll.
Returns the start Y offset in the scroll.
Returns whether the scroller has finished scrolling.
Start scrolling by providing a starting point and the distance to travel. The scroll will use the default value of 250 milliseconds for the duration.
startX | Starting horizontal scroll offset in pixels. Positive numbers will scroll the content to the left. |
---|---|
startY | Starting vertical scroll offset in pixels. Positive numbers will scroll the content up. |
dx | Horizontal distance to travel. Positive numbers will scroll the content to the left. |
dy | Vertical distance to travel. Positive numbers will scroll the content up. |
Start scrolling by providing a starting point and the distance to travel.
startX | Starting horizontal scroll offset in pixels. Positive numbers will scroll the content to the left. |
---|---|
startY | Starting vertical scroll offset in pixels. Positive numbers will scroll the content up. |
dx | Horizontal distance to travel. Positive numbers will scroll the content to the left. |
dy | Vertical distance to travel. Positive numbers will scroll the content up. |
duration | Duration of the scroll in milliseconds. |