最近看一个例子
进度条最左边的绘制,绘制圆弧往右移,使用了一个方法
drawArc(RectF oval, float startAngle, float sweepAngle, boolean useCenter, Paint paint)
关于boolean useCenter 参数的解释是:
* @param useCenter If true, include the center of the oval in the arc, and
close it if it is being stroked. This will draw a wedge
粗略的翻译是:如果该值为true,圆弧所在的椭圆中心也会被填充。
直接用例子来的体现:
canvas.drawArc(mArcRectF, 0, 90, false, mOrangePaint);如下图:
canvas.drawArc(mArcRectF, 0, 90, true, mOrangePaint);如下图:
可以看到相同的角度,但是通过限制填充中心来绘制出不一样的图形。那么进度条就有了眉目,我们可以通过进度长度计算吃对应的弧的角度,就可以绘制出最左边圆弧进度变化了。