Мне нужно создать индикатор в форме дуги. я должен создать собственное представление для этого? Или с помощью onDraw()
метода класса ProgressBar я могу выполнить эту вещь? Я также хочу добавить маркер на этот индикатор прогресса, как термометр. Пожалуйста, предложите мне любую идею. Благодаря.
Примерно так:
protected synchronized void onDraw(Canvas canvas) {
int progress = this.getProgress();
int maxProgress = this.getMax();
//calc the progress to angles
float angleProgress = progress * 360 / maxProgress;
//create and set the arc paint
Paint arcPaint = new Paint();
arcPaint.setColor(0xff800000);
arcPaint.setAntiAlias(true);
arcPaint.setStyle(Style.FILL);
Rect arcRect = new Rect(); this.getDrawingRect(arcRect);
canvas.drawArc(new RectF(arcRect), -90, angleProgress,true, arcPaint);
}
Для проверки проверьте это изображение формы дуги прогрессбар
![http://i.stack.imgur.com/FY0dq.png](https://i.stack.imgur.com/5NdeK.png)