How to make a Square progress-bar with changing color in certain time interval? [closed]

限于喜欢 提交于 2019-12-11 13:57:38

问题


I want a square progressbar like in above images, which should change color at certain condition. Exactly like zynga poker.
lets take total duration is 6 seconds.

2sec-green

2sec-yellow

2sec-red

As this


回答1:


You can use canvas for making a custom view like this. For more info: http://developer.android.com/reference/android/graphics/Canvas.html

Example Android canvas draw rectangle

Logic You need to draw 4 lines, then start erasing them using timer. After each line is erased completely, change color of other lines, and so on.



来源:https://stackoverflow.com/questions/24218153/how-to-make-a-square-progress-bar-with-changing-color-in-certain-time-interval

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!