ScrollerCompat
classScrollerCompat
kotlin.Any | |
↳ | androidx.core.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.
Summary
Public methods | |
---|---|
Unit |
Stops the animation. |
Boolean |
Call this when you want to know the new location. |
static ScrollerCompat! | |
static ScrollerCompat! |
create(context: Context!, interpolator: Interpolator!) |
Unit |
fling(startX: Int, startY: Int, velocityX: Int, velocityY: Int, minX: Int, maxX: Int, minY: Int, maxY: Int) Start scrolling based on a fling gesture. |
Unit |
fling(startX: Int, startY: Int, velocityX: Int, velocityY: Int, minX: Int, maxX: Int, minY: Int, maxY: Int, overX: Int, overY: Int) Start scrolling based on a fling gesture. |
Float |
Returns the current velocity on platform versions that support it. |
Int |
getCurrX() Returns the current X offset in the scroll. |
Int |
getCurrY() Returns the current Y offset in the scroll. |
Int | |
Int | |
Boolean |
Returns whether the scroller has finished scrolling. |
Boolean |
Returns whether the current Scroller is currently returning to a valid position. |
Unit |
notifyHorizontalEdgeReached(startX: Int, finalX: Int, overX: Int) Notify the scroller that we've reached a horizontal boundary. |
Unit |
notifyVerticalEdgeReached(startY: Int, finalY: Int, overY: Int) Notify the scroller that we've reached a vertical boundary. |
Boolean |
Call this when you want to 'spring back' into a valid coordinate range. |
Unit |
startScroll(startX: Int, startY: Int, dx: Int, dy: Int) Start scrolling by providing a starting point and the distance to travel. |
Unit |
Start scrolling by providing a starting point and the distance to travel. |
Public methods
abortAnimation
funabortAnimation(): Unit
Deprecated: Use OverScroller#abortAnimation()
directly.
Stops the animation. Aborting the animation causes the scroller to move to the final x and y position.
computeScrollOffset
funcomputeScrollOffset(): Boolean
Deprecated: Use OverScroller#computeScrollOffset()
directly.
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.
create
static funcreate(context: Context!): ScrollerCompat!
Deprecated: Use OverScroller
constructor directly.
create
static funcreate(
context: Context!,
interpolator: Interpolator!
): ScrollerCompat!
Deprecated: Use OverScroller
constructor directly.
fling
funfling(
startX: Int,
startY: Int,
velocityX: Int,
velocityY: Int,
minX: Int,
maxX: Int,
minY: Int,
maxY: Int
): Unit
Deprecated: Use OverScroller#fling(int, int, int, int, int, int, int, int)
directly.
Start scrolling based on a fling gesture. The distance travelled will depend on the initial velocity of the fling.
Parameters | |
---|---|
startX |
Int: Starting point of the scroll (X) |
startY |
Int: Starting point of the scroll (Y) |
velocityX |
Int: Initial velocity of the fling (X) measured in pixels per second. |
velocityY |
Int: Initial velocity of the fling (Y) measured in pixels per second |
minX |
Int: Minimum X value. The scroller will not scroll past this point. |
maxX |
Int: Maximum X value. The scroller will not scroll past this point. |
minY |
Int: Minimum Y value. The scroller will not scroll past this point. |
maxY |
Int: Maximum Y value. The scroller will not scroll past this point. |
fling
funfling(
startX: Int,
startY: Int,
velocityX: Int,
velocityY: Int,
minX: Int,
maxX: Int,
minY: Int,
maxY: Int,
overX: Int,
overY: Int
): Unit
Deprecated: Use OverScroller#fling(int, int, int, int, int, int, int, int, int, int)
directly.
Start scrolling based on a fling gesture. The distance travelled will depend on the initial velocity of the fling.
Parameters | |
---|---|
startX |
Int: Starting point of the scroll (X) |
startY |
Int: Starting point of the scroll (Y) |
velocityX |
Int: Initial velocity of the fling (X) measured in pixels per second. |
velocityY |
Int: Initial velocity of the fling (Y) measured in pixels per second |
minX |
Int: Minimum X value. The scroller will not scroll past this point. |
maxX |
Int: Maximum X value. The scroller will not scroll past this point. |
minY |
Int: Minimum Y value. The scroller will not scroll past this point. |
maxY |
Int: Maximum Y value. |