2
원호 모양의 진행 막대를 만들어야합니다. 이를 위해 사용자 정의보기를 만들어야합니까? 또는 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);
}
심판 체크 본 이미지는 아크 모양의 ProgressBar
다음과 같은 것은 어떨까요 : http://phrogz.net/tmp/canvas_gauge.html 자바 스크립트로 작성되었지만 HTML5 캔버스를 사용합니다. 비슷한 경우 소스를보고 위젯을 그리는 방법을 잘 이해할 수 있습니다. – Jonathan