0
Мне нужен круговой индикатор выполнения, который не показывает мне прогресс от 0 до 100. Он должен показать мне конкретное число, которое можно вычесть до 0. Thx для ответов :)Android Circular Progress Bar
Мне нужен круговой индикатор выполнения, который не показывает мне прогресс от 0 до 100. Он должен показать мне конкретное число, которое можно вычесть до 0. Thx для ответов :)Android Circular Progress Bar
Check this link it is the best way as my point of view
Сделать TextProgressBar
public class TextProgressBar extends ProgressBar {
private String text;
private Paint textPaint;
public TextProgressBar(Context context) {
super(context);
text = "HP";
textPaint = new Paint();
textPaint.setColor(Color.BLACK);
}
public TextProgressBar(Context context, AttributeSet attrs) {
super(context, attrs);
text = "HP";
textPaint = new Paint();
textPaint.setColor(Color.BLACK);
}
public TextProgressBar(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
text = "HP";
textPaint = new Paint();
textPaint.setColor(Color.BLACK);
}
@Override
protected synchronized void onDraw(Canvas canvas) {
// First draw the regular progress bar, then custom draw our text
super.onDraw(canvas);
Rect bounds = new Rect();
textPaint.getTextBounds(text, 0, text.length(), bounds);
int x = getWidth()/2 - bounds.centerX();
int y = getHeight()/2 - bounds.centerY();
canvas.drawText(text, x, y, textPaint);
}
public synchronized void setText(String text) {
this.text = text;
drawableStateChanged();
}
public void setTextColor(int color) {
textPaint.setColor(color);
drawableStateChanged();
}
}
я уже дал ответ в этой ссылке