How to make a seekBar with negative values?

781 Views Asked by At

I tried some libraries from Github but either they don't work or I couldn't figure out how to make them work.

I just want to create a seekbar with float values, with a center of 0.

1

There are 1 best solutions below

1
On BEST ANSWER

You can use the Slider in the Material Components Library

    <com.google.android.material.slider.Slider
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:labelBehavior="withinBounds"
        android:valueFrom="-10.0"
        android:valueTo="10.0"
        android:stepSize="1.0"/>

enter image description here

NOTE: it requires the version 1.2.0 (currently 1.2.0-rc01) of the library.