ScrollerPosition

@Model class ScrollerPosition
kotlin.Any
   ↳ androidx.ui.foundation.ScrollerPosition

This is the state of a VerticalScroller and HorizontalScroller that allows the developer to change the scroll position by calling methods on this object.

Summary

Public constructors

<init>(initial: Float = 0f)

This is the state of a VerticalScroller and HorizontalScroller that allows the developer to change the scroll position by calling methods on this object.

Public methods

Unit
scrollBy(value: Px)

Instantly jump by some amount of pixels

Unit
scrollTo(value: Px)

Instantly jump to position in pixels

Unit
smoothScrollBy(value: Px, onEnd: (endReason: AnimationEndReason, finishValue: Float) -> Unit = { _, _ -> })

Smooth scroll by some amount of pixels

Unit
smoothScrollTo(value: Px, onEnd: (endReason: AnimationEndReason, finishValue: Float) -> Unit = { _, _ -> })

Smooth scroll to position in pixels

Properties

FlingConfig

Fling configuration that specifies fling logic when scrolling ends with velocity.

Px

maxPosition this scroller that consume this ScrollerPosition can reach, or Px.Infinity if still unknown

Px

current position for scroller

Public constructors

<init>

ScrollerPosition(initial: Float = 0f)

This is the state of a VerticalScroller and HorizontalScroller that allows the developer to change the scroll position by calling methods on this object.

Public methods

scrollBy

fun scrollBy(value: Px): Unit

Instantly jump by some amount of pixels

Parameters
value: Px delta to jump by

scrollTo

fun scrollTo(value: Px): Unit

Instantly jump to position in pixels

Parameters
value: Px target value to jump to

smoothScrollBy

fun smoothScrollBy(
    value: Px,
    onEnd: (endReason: AnimationEndReason, finishValue: Float) -> Unit = { _, _ -> }
): Unit

Smooth scroll by some amount of pixels

Parameters
value: Px delta to scroll by

smoothScrollTo

fun smoothScrollTo(
    value: Px,
    onEnd: (endReason: AnimationEndReason, finishValue: Float) -> Unit = { _, _ -> }
): Unit

Smooth scroll to position in pixels

Parameters
value: Px target value to smooth scroll to

Properties

flingConfig

var flingConfig: FlingConfig

Fling configuration that specifies fling logic when scrolling ends with velocity.

See FlingConfig for more info.

maxPosition

var maxPosition: Px

maxPosition this scroller that consume this ScrollerPosition can reach, or Px.Infinity if still unknown

value

val value: Px

current position for scroller