views:

281

answers:

1

Hello,

I have two questions:

1) how do I change the color of the seek bar (path) from yellow (the default color) to white. What I mean to say is, while I slide the thumb , it turns the line traversed from grey to yellow. I want track/line to either remain grey or white..Basically I want just the thumb to move with no color change in the seek bar.

2) How to change the thumb of seekbar from rectangle to circle/sphere/round shape.

any pointers will be appreciated.

+1  A: 

You should set SeekBar XML properties:

<SeekBar 
            ....
    android:progressDrawable="@drawable/progress"
    android:thumb="@drawable/thumb"
            ....
/>

Where progress is something like this:

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

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

and thumb is

<?xml version="1.0" encoding="utf-8"?>    
   <selector xmlns:android="http://schemas.android.com/apk/res/android"&gt;
   <item android:drawable="@drawable/thumb_fill" />
</selector>
Asahi
Hello,I tried to create above .xml files in drawable folder. but I got this error: No resource found that matches the given name (at 'drawable' with value '@drawable/background_fill'). No resource found that matches the given name (at 'drawable' with value '@drawable/progress_fill').
Those are drawables that you have to create yourself:you could use 9.png (or another drawable resource - http://developer.android.com/reference/android/graphics/drawable/Drawable.html and http://developer.android.com/guide/topics/resources/drawable-resource.html) to decorate your seekbar as you wish.
Asahi