开发者

Custom ProgressBar With Multi Color

My Application requirement is custom progressbar.A Custom Progress Which have Multicolor Indication.For example Progress Smaller than 30 shown with Green Color .Progress Smaller than 60 and Greater than 30 shown with yellow color and final开发者_开发技巧ly the Progress From 60 to 100 Shown with Red Color .

i would like to make progress bar like this

http://www.android2freeware.com/Application/34/2011-08/10906.html#.TlTvqmEmsg_

I am new to android development.

Thanks In Advance


Extend the Seekbar class and override its onDraw() method. There you can draw the thumb and progress background however you want.


Create a drawable progress background statically (easier than drawing in program.) and add to resources. You can set this as progress drawable in xml or in your custom class constructor.

class MySeekbar extends Seekbar {

    // In Constructor load the thumb image into static members.

    // override onDraw draw the thumb.
    void onDraw(Canvas canvas) {
         canvas.save();
         canvas.drawBitmap(mThumb, left, top, right, bottom);
         canvas.restore();
    }
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜