views:

450

answers:

1

Hi all,

Using progress_horizontal.xml as a base drawable for my seekbar i was able to customize it pretty well. But unfortunately i stuck with the following problem. I need my progress to be made from two horizontal lines with different color something like this http://picasaweb.google.com/manigoad/Other#5442553107070487330 . In this case a blue line and transparent line below it.

So how can i make my progress to be made from two different colors. Tnaks

+1  A: 

I've had a look into creating the "stack" of shapes that you are looking for using "drawable" XML, but the padding/height values seem to be ignored.

There are two possible workarounds that I can think of:

Create a class that implements Drawable for the background and the progress and draw the custom colours/gradients yourself.

-OR-

Create a PNG of the background (on the right) and progress (on the left) from your mockups. About 30px wide should be fine (if you make them 1px wide, it will be put more pressure on the layout because it has to be repeated more times). Throw those in res/drawable/ and then load them into your styles using <bitmap>:

<layer-list xmlns:android="http://schemas.android.com/apk/res/android"&gt;

    <item android:id="@android:id/background">
        <bitmap android:src="@drawable/scroll_bg" />
    </item>

    <item android:id="@android:id/progress">
        <clip>
            <bitmap android:src="@drawable/scroll_progress" />
        </clip>
    </item>

</layer-list>
Richard Szalay
How can i customize thumb in seek bar?
Eby
@Eby - you should ask that as it's own question (although I'm afraid I don't know the answer)
Richard Szalay