4

I would like to change the background color of a SeekBar from yellow (default) to a color I choose but I've only found the method to change the color of the black area around the SeekBar. Can anyone help me????

Cippo
  • 1,001
  • 4
  • 14
  • 26
  • see this : [http://stackoverflow.com/questions/3480456/seek-bar-change-path-color-from-yellow-to-white][1] [1]: http://stackoverflow.com/questions/3480456/seek-bar-change-path-color-from-yellow-to-white – AliSh Mar 04 '12 at 12:52

1 Answers1

9

xmls ( background_fill , progress_fill and progress could look like that for a gradient red

progress xml

  <?xml version="1.0" encoding="utf-8"?>
                <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
                <item android:id="@android:id/background" 
android:drawable="@drawable/background_fill" />

                <item android:id="@android:id/progress">
                <clip android:drawable="@drawable/progress_fill" />
                </item>
                </layer-list>

background_fill xml

<?xml version="1.0" encoding="UTF-8"?>
                <shape xmlns:android="http://schemas.android.com/apk/res/android">
           <gradient android:startColor="#FF555555" android:centerColor="#FF555555"
    android:endColor="#FF555555" android:angle="90" />
            <corners android:radius="5px" />
            <stroke android:width="2dp" android:color="#50999999" />
            <stroke android:width="1dp" android:color="#70555555" />
                </shape>

and progress_fill xml

 <?xml version="1.0" encoding="UTF-8"?>
                 <shape xmlns:android="http://schemas.android.com/apk/res/android">
             <gradient android:startColor="#FF470000" android:centerColor="#FFB80000"
    android:endColor="#FFFF4400" android:angle="180" />
             <corners android:radius="5px" />
             <stroke android:width="2dp" android:color="#50999999" />
             <stroke android:width="1dp" android:color="#70555555" />
                 </shape>

i did not complete the implementing for android:thumb, so the thumb will be still the original one

Therefore we just have to delete this line again from our layout xml where we define the seekbar

android:thumb="@drawable/thumb"

for more info see this link

Community
  • 1
  • 1
Parag Chauhan
  • 35,760
  • 13
  • 86
  • 95