java.lang.Object | |
↳ | android.support.v4.widget.ScrollerCompat |
Provides access to new
Scroller
APIs when available.
This class provides a platform version-independent mechanism for obeying the current device's preferred scroll physics and fling behavior. It offers a subset of the APIs from Scroller or OverScroller.
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
Stops the animation.
|
||||||||||
|
Call this when you want to know the new location.
|
||||||||||
|
|
||||||||||
|
|
||||||||||
|
Start scrolling based on a fling gesture.
|
||||||||||
|
Start scrolling based on a fling gesture.
|
||||||||||
|
Returns the current velocity on platform versions that support it.
|
||||||||||
|
Returns the current X offset in the scroll.
|
||||||||||
|
Returns the current Y offset in the scroll.
|
||||||||||
|
|
||||||||||
|
|
||||||||||
|
Returns whether the scroller has finished scrolling.
|
||||||||||
|
Returns whether the current Scroller is currently returning to a valid position.
|
||||||||||
|
Notify the scroller that we've reached a horizontal boundary.
|
||||||||||
|
Notify the scroller that we've reached a vertical boundary.
|
||||||||||
|
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
|
Stops the animation. Aborting the animation causes the scroller to move to the final x and y position.
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.
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. |
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. |
overX | Overfling range. If > 0, horizontal overfling in either direction will be possible. |
overY | Overfling range. If > 0, vertical overfling in either direction will be possible. |
Returns the current velocity on platform versions that support it.
The device must support at least API level 14 (Ice Cream Sandwich).
On older platform versions this method will return 0. This method should
only be used as input for nonessential visual effects such as
EdgeEffectCompat
.
Returns the current X offset in the scroll.
Returns the current Y offset in the scroll.
Returns whether the scroller has finished scrolling.
Returns whether the current Scroller is currently returning to a valid position.
Valid bounds were provided by the
fling(int, int, int, int, int, int, int, int, int, int)
method.
One should check this value before calling
startScroll(int, int, int, int)
as the interpolation currently in progress
to restore a valid position will then be stopped. The caller has to take into account
the fact that the started scroll will start from an overscrolled position.
Notify the scroller that we've reached a horizontal boundary. Normally the information to handle this will already be known when the animation is started, such as in a call to one of the fling functions. However there are cases where this cannot be known in advance. This function will transition the current motion and animate from startX to finalX as appropriate.
startX | Starting/current X position |
---|---|
finalX | Desired final X position |
overX | Magnitude of overscroll allowed. This should be the maximum desired distance from finalX. Absolute value - must be positive. |
Notify the scroller that we've reached a vertical boundary. Normally the information to handle this will already be known when the animation is started, such as in a call to one of the fling functions. However there are cases where this cannot be known in advance. This function will animate a parabolic motion from startY to finalY.
startY | Starting/current Y position |
---|---|
finalY | Desired final Y position |
overY | Magnitude of overscroll allowed. This should be the maximum desired distance from finalY. Absolute value - must be positive. |
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. |