Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to show slider value above the slider also when we are not sliding using material.slider in Android?

This is how I want to show the value of the slider. Please find the picture

Sample slider image

like image 644
kamaal4 Avatar asked Oct 27 '25 10:10

kamaal4


1 Answers

You can set the label behaviour "visible" in the XML file. So in the slider XML code, you just need to add

app:labelBehavior="visible"

Below I am attaching a sample XML code for the same.

    <com.google.android.material.slider.Slider
        android:id="@+id/seek_bar"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:valueFrom="1"
        android:valueTo="100"
        android:layout_gravity="center"
        android:layout_margin="15dp"
        app:tickColor="#0000FF"
        app:labelStyle="@style/Tooltip"
        app:labelBehavior="visible"
        />
like image 196
Aatman Vaidya Avatar answered Oct 30 '25 00:10

Aatman Vaidya



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!