I want to change SeekBar
color, precisely I want to change color of dot that is dragged to change the progress value. I know I can do it by changing "colorAccent" value but that's not what I'm up to.
The dot you're refering to is called the SeekBar Thumb. To change the color of the Seekbar thumb, create a new style in style.xml
Change Via XML
<SeekBar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:thumbTint="your_color" //gives your color
android:thumb="@drawable/yourseekthumb" //gives your drawable
android:theme="@style/SeekBarColor" />
You can either give your color using thumbTint
or your drawable using android:thumb
.
This method works for API>16.
To change SeekBar thumb color by Java code
SeekBar seekbar = (SeekBar) findViewById(R.id.seekBar);
seekbar.getThumb().setColorFilter(your_color, PorterDuff.Mode.MULTIPLY);
This method works for only android 5 and above.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With