{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

RangeSliderState

@ExperimentalMaterial3Api
public final class RangeSliderState


Class that holds information about RangeSlider's active range.

Summary

Public constructors

RangeSliderState(
    float activeRangeStart,
    float activeRangeEnd,
    @IntRange int steps,
    Function0<Unit> onValueChangeFinished,
    @NonNull ClosedFloatingPointRange<@NonNull Float> valueRange
)

Public methods

final float

Float that indicates the end of the current active range for the RangeSlider.

final float

Float that indicates the start of the current active range for the RangeSlider.

final Function0<Unit>

lambda to be invoked when value change has ended.

final int

if greater than 0, specifies the amounts of discrete values, evenly distributed between across the whole value range.

final @NonNull ClosedFloatingPointRange<@NonNull Float>

range of values that Range Slider values can take.

final void
setActiveRangeEnd(float activeRangeEnd)

Float that indicates the end of the current active range for the RangeSlider.

final void
setActiveRangeStart(float activeRangeStart)

Float that indicates the start of the current active range for the RangeSlider.

Public constructors

RangeSliderState

public RangeSliderState(
    float activeRangeStart,
    float activeRangeEnd,
    @IntRange int steps,
    Function0<Unit> onValueChangeFinished,
    @NonNull ClosedFloatingPointRange<@NonNull Float> valueRange
)
Parameters
float activeRangeStart

Float that indicates the initial start of the active range of the slider. If outside of valueRange provided, value will be coerced to this range.

float activeRangeEnd

Float that indicates the initial end of the active range of the slider. If outside of valueRange provided, value will be coerced to this range.

@IntRange int steps

if greater than 0, specifies the amounts of discrete values, evenly distributed between across the whole value range. If 0, range slider will behave as a continuous slider and allow to choose any value from the range specified. Must not be negative.

Function0<Unit> onValueChangeFinished

lambda to be invoked when value change has ended. This callback shouldn't be used to update the range slider values (use onValueChange for that), but rather to know when the user has completed selecting a new value by ending a drag or a click.

@NonNull ClosedFloatingPointRange<@NonNull Float> valueRange

range of values that Range Slider values can take. activeRangeStart and activeRangeEnd will be coerced to this range.

Public methods

getActiveRangeEnd

public final float getActiveRangeEnd()

Float that indicates the end of the current active range for the RangeSlider.

getActiveRangeStart

public final float getActiveRangeStart()

Float that indicates the start of the current active range for the RangeSlider.

getOnValueChangeFinished

public final Function0<UnitgetOnValueChangeFinished()

lambda to be invoked when value change has ended. This callback shouldn't be used to update the range slider values (use onValueChange for that), but rather to know when the user has completed selecting a new value by ending a drag or a click.

getSteps

public final int getSteps()

if greater than 0, specifies the amounts of discrete values, evenly distributed between across the whole value range. If 0, range slider will behave as a continuous slider and allow to choose any value from the range specified. Must not be negative.

getValueRange

public final @NonNull ClosedFloatingPointRange<@NonNull FloatgetValueRange()

range of values that Range Slider values can take. activeRangeStart and activeRangeEnd will be coerced to this range.

setActiveRangeEnd

public final void setActiveRangeEnd(float activeRangeEnd)

Float that indicates the end of the current active range for the RangeSlider.

setActiveRangeStart

public final void setActiveRangeStart(float activeRangeStart)

Float that indicates the start of the current active range for the RangeSlider.