Skip to content

The Slider Form Cell

The slider form cell represents a key value cell in which the value is an Integer object that is controlled by a Seekbar. This cell also supports facilities to set helper or error texts. A user interacts with the cell using Seekbar.

Using the Slider Form Cell

This form cell can be used within your activity like any traditional Android view:

                    app:key="Estimated Distance"
                    app:label="10 miles"
                    app:value="10" />

Editable and Non-Editable Modes

For the slider form cell, editable and enabled attributes are the same: a non-editable form cell is not enabled (not clickable, not focusable and 50% alpha). By default, the slider form cell is editable and enabled. You can control the editability of the cell by using XML attribute app:editable="false, You can also fetch the view in your activity and set it to be editable:

       SliderFormCell mSliderFormCell = findViewById(;

For more information about the editable attribute, see FormCell.

Error and Helper Texts

To set the error and helper text on the view, enable the feature on the view by calling setErrorEnabled and setHelperEnabled respectively. You can also use app:errorEnabled and app:helperEnabled XML attributes to enable the support for these features. Once enabled, you can call setError(CharSequence) to set the error text and setHelperText to set the helper text. Once set, the error/helper text remains enabled until setErrorEnabled(false)/setHelperEnabled(false) is called.

Error and Helper Texts

Listening for Cell Value Changes

To listen for updates to a cell value, attach a CellValueChangeListener\ using setCellValueChangeListener:

mSliderFormCell.setCellValueChangeListener(new FormCell.CellValueChangeListener<Integer>() {
            protected void cellChangeHandler(@NonNull Integer value) {
                // App level logic

Also see FormCell

Start and End Labels

The slider form cell supports two UI components known as the start and end labels. These labels are used for providing additional textual or visual aids to a user. By default, the start and end labels show the minimum and maximum values of the cell. You can replace the label text with custom text or informative icons such as volume low and volume high.

The following attributes and APIs are available to help you control different aspects of the start and end labels:

XML Attribute Java API Description
startLabelEnabled setStartLabelEnabled(boolean) Enable or disable the start label. Default: Enabled
endLabelEnabled setEndLabelEnabled(boolean) Enable or disable the end label. Default: Enabled
startLabelText setStartLabelText(CharSequence) Set the text on the start label, such as minimum possible value.
endLabelText setEndLabelText(CharSequence) Set the text on the end label, such as maximum possible value.
startLabelIcon setStartLabelIcon(@DrawableRes int) Set the icon on the start label, such as volume low control.
endLabelIcon setEndLabelIcon(@DrawableRes int) Set the icon on the end label, such as volume high control.
startLabelSingleLine setStartLabelSingleLine(boolean) Set the start label text to single line only.
endLabelBackground setEndLabelBackground(@Nullable Drawable res) Set the background of the end label. This is useful when using endLabelIcon.
endLabelEms setEndLabelEms(int) Set the Ems on the end label element. This controls the width of the end label.


Editable End Label

The end label of the cell can be converted into an editable text view to control the value of the cell using keypad. Using XML attribute app:endLabelEditControl or API setEndLabelEditControl(boolean), enable or disable the onBindView of the end label view:

Editable End Label

Last update: April 14, 2021