我想在画布上画两个彩色圆圈。一切都是正确的,但圈子并不顺利。这是效果:
这是代码:
private void drawCircle(Canvas c)
{
RectF oval = new RectF(20, 20, 100, 100);
c.drawArc(oval, -90, 180, false, getPaintWithColor(R.color.background));
c.drawArc(oval, 90, 180, false, getPaintWithColor(R.color.font_grey));
}
private Paint getPaintWithColor(int colorId){
Paint paint = new Paint();
paint.setAntiAlias(true);
paint.setDither(true);
paint.setStyle(Paint.Style.STROKE);
paint.setStrokeWidth(4);
paint.setColor(getResources().getColor(colorId));
return paint;
}