円弧状のプログレスバーを作成する必要があります。そのためのカスタムビューを作成する必要がありますか?または、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);
}
参照については、この画像の円弧形状のプログレスバーを確認してください