How to make a custom progressbar in Android?

≯℡__Kan透↙ 提交于 2019-12-06 21:08:31

问题


What would be the best way to make somthing looking like this:

The text on it needs to be customizable, not only numbers, some strings too, depending on context.

From what I see it:

  1. Create a custom View and within onDraw perform all the calculations and text alignment.
  2. Style or extend a horizontal ProgressBar.

What do you think ?


回答1:


Extend ProgressBar ... override onDraw()

The primary reason for this is that all of the primary methods are already there and the first rule of object-orientated programming is code-reuse means don't reinvent the wheel.



来源:https://stackoverflow.com/questions/8929062/how-to-make-a-custom-progressbar-in-android

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