[英]Android: Best way to create a custom shaped Progressbar
I would like to create a custom shaped progressbar, which would change color according to its progress (but this is almost a different question..). 我想创建一个自定义形状的进度条,该进度条会根据其进度更改颜色(但这几乎是一个不同的问题..)。
So what would be the best way to create a custom shaped progressbar like the one on the image below (sorry for bad MS Paint drawing skills): 因此,创建自定义形状进度条的最佳方法是哪种方式(如下图所示)(抱歉,MS Paint的绘图技巧很差):
To have all possibilities you should create a custom class derived from progressbar and completely override the onDraw() Method. 为了有所有可能,您应该创建一个从progressbar派生的自定义类,并完全覆盖onDraw()方法。 to draw the Arch on the side you can use
canvas.drawArc()
and to change the color of the bar you can simply adjust the Paint Color. 要在侧面绘制Arch,可以使用
canvas.drawArc()
并更改条的颜色,您只需调整“ Paint Color”即可。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.