Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 453
Malo Avatar asked Nov 15 '25 03:11

Malo


2 Answers

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

like image 109
Ali Moghadam Avatar answered Nov 17 '25 16:11

Ali Moghadam


You can use app:trackColor="Your color" for changing color of the track

like image 41
Çağrı Avatar answered Nov 17 '25 18:11

Çağrı



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!