ved gaur
ved gaur

Reputation: 56

How can i create range seek bar in android java with indicator?

I want to create range seekbar in my app. But i can't create perfectly seekbar according to image. How can i create Please tell me any one. Thanks example

Upvotes: 1

Views: 7750

Answers (1)

Gabriele Mariotti
Gabriele Mariotti

Reputation: 364035

You can use the RangeSlider provided by the Material Components library:

        <com.google.android.material.slider.RangeSlider
            app:labelBehavior="withinBounds"
            android:valueFrom="0"
            android:valueTo="10000"
            app:values="@array/initial_slider_values"
        />

with:

<resources>
  <array name="initial_slider_values">
    <item>2000</item>
    <item>3500</item>
  </array>
</resources>

enter image description here

You can also use the method setValues():

RangeSlider slider = findViewById(R.id.slider);
slider.setValues(2000f,3500f);

Upvotes: 9

Related Questions