PositionIndicatorState

Interface

Android
public interface PositionIndicatorState

An object representing the relative position of a scrollbar or rolling side button or rotating bezel position. This interface is implemented by classes that adapt other state information such as ScalingLazyListState or ScrollState of scrollable containers or to represent the position of say a volume control that can be 'ticked' using a rolling side button or rotating bezel.

Implementing classes provide positionFraction to determine where in the range 0..1 that the indicator should be displayed and sizeFraction to determine the size of the indicator in the range 0..1. E.g. If a ScalingLazyListState had 50 items and the last 5 were visible it would have a position of 1.0f to show that the scroll is positioned at the end of the list and a size of 5 / 50 = 0.1f to indicate that 10% of the visible items are currently visible.

Functions

@FloatRange(from = 0.0, to = 1.0)
    public fun sizeFraction(@FloatRange(from = 0.0) scrollableContainerSizePx: Float): Float

Size of the indicator in the range 0f,1f. 1f means it takes the whole space.

Parameters

scrollableContainerSizePxthe height or width of the container in pixels depending on orientation of the indicator, (height for vertical, width for horizontal)
public fun visibility(
        @FloatRange(from = 0.0) scrollableContainerSizePx: Float
    ): PositionIndicatorVisibility

Should we show the Position Indicator

Parameters

scrollableContainerSizePxthe height or width of the container in pixels depending on orientation of the indicator, (height for vertical, width for horizontal)