We just launched Compose Examples featuring over 150+ components! Check it out →

scrollableWithPivot

Android

Modifier in Tv Foundation

Configure touch scrolling and flinging for the UI element in a single [Orientation].

Users should update their state themselves using default [ScrollableState] and its consumeScrollDelta callback or by implementing [ScrollableState] interface manually and reflect their own state in UI when using this component.

Last updated:

Installation

dependencies {
   implementation("androidx.tv:tv-foundation:1.0.0-alpha11")
}

Overloads

@Deprecated(
    "scrollableWithPivot has been deprecated. Construct a custom bringIntoViewSpec to scroll with an offset. To learn how you can control offset during scrolling, refer PivotBringIntoViewSpec: https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/gestures/BringIntoViewSpec.android.kt;l=48;drc=dcaa116fbfda77e64a319e1668056ce3b032469f",
    replaceWith =
        ReplaceWith(
            "scrollable(" +
                "state = state, " +
                "orientation = orientation, " +
                "enabled = enabled, " +
                "reverseDirection = reverseDirection" +
                ")"
        )
)
@OptIn(ExperimentalFoundationApi::class)
@ExperimentalTvFoundationApi
@Suppress("DEPRECATION")
fun Modifier.scrollableWithPivot(
    state: ScrollableState,
    orientation: Orientation,
    pivotOffsets: PivotOffsets,
    enabled: Boolean = true,
    reverseDirection: Boolean = false
): Modifier

Parameters

namedescription
state[ScrollableState] state of the scrollable. Defines how scroll events will be interpreted by the user land logic and contains useful information about on-going events.
orientationorientation of the scrolling
pivotOffsetsoffsets of child element within the parent and starting edge of the child from the pivot defined by the parentOffset.
enabledwhether or not scrolling in enabled
reverseDirectionreverse the direction of the scroll, so top to bottom scroll will behave like bottom to top and left to right will behave like right to left. drag events when this scrollable is being dragged.
by @alexstyl