Search code examples
androidsliderstylesrangeslider

how to change line and thumb color in slider android material design?


i have a rangelsider created in xml like the code below

     <com.google.android.material.slider.RangeSlider
android:id="@+id/dataSlider"
android:layout_height="5dp"
android:layout_width="match_parent"
 android:valueFrom="0.0"
android:visibility="visible"
android:valueTo="100.0"
app:values="@array/initial_slider_values"  />

i want to change the color of thumb circle and make it smaller, also want to change the line color , the styling doesn't work


Solution

  • You can use these attrbutes

    Tick

    app:tickColor
    app:tickColorActive
    app:tickColorInactive
    

    Thumb

    app:thumbColor
    app:haloColor
    app:thumbStrokeColor
    
    app:thumbRadius
    

    More attrbutes and implemention https://material.io/components/sliders/android#using-sliders