Google은 흑인 공동체를 위한 인종 간 평등을 진전시키기 위해 노력하고 있습니다. Google에서 어떤 노력을 하고 있는지 확인하세요.

ScrollerCompat

class ScrollerCompat
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!
create(context: Context!)

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

Returns the current X offset in the scroll.

Int

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
springBack(startX: Int, startY: Int, minX: Int, maxX: Int, minY: Int, maxY: Int)

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
startScroll(startX: Int, startY: Int, dx: Int, dy: Int, duration: Int)

Start scrolling by providing a starting point and the distance to travel.

Public methods

abortAnimation

fun abortAnimation(): 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

fun computeScrollOffset(): 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 fun create(context: Context!): ScrollerCompat!

Deprecated: Use OverScroller constructor directly.

create

static fun create(
    context: Context!,
    interpolator: Interpolator!
): ScrollerCompat!

Deprecated: Use OverScroller constructor directly.

fling

fun fling(
    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

fun fling(
    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. The scroller will not scroll past this point.
overX Int: Overfling range. If > 0, horizontal overfling in either direction will be possible.
overY Int: Overfling range. If > 0, vertical overfling in either direction will be possible.

getCurrVelocity

fun getCurrVelocity(): Float<