Customize Android Seekbar Color

How to customize the colors for android seekbar

1 minute read

I was tasked to create a simple media player app for a shop demo, and I’m using the built-in SeekBar for the volume control. All goes well, until I want to change the color of it. The design has it like the thumb of the SeekBar is white, and first half is green and rest half is grey. It took me almost a whole day to find a satisfying anwser, come on Android!

But anyway, here is the simplest way that I can find.

  1. Define an volume_control.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="" >
    <item android:id="@android:id/background">
        <shape android:shape="rectangle" >
                android:color="@color/grey" />
    <item android:id="@android:id/progress">
            <shape android:shape="rectangle" >
                    android:color="@color/green" />
  1. Then in the layout file, define a SeekBar as follows:

Pay attention to the maxHeight and minHeight, without them the bar will look very thick. Also that to change the color of thumb, you can do thumbTint.

I have seen other solutions like create a new theme and assign it to the SeekBar, or completely write a SeekBar yourself, but they all seem overkill for such a simple task.

comments powered by Disqus