开发者

seekbar progress customization

Using progress_horizontal.xml as a base drawable for m开发者_StackOverflowy 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


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">

    <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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜