Android 画布上的圆弧没有抗锯齿
我想在画布上画两个彩色的圆圈。一切都是对的,但圆圈并不平滑。 这就是效果: 这是代码:Android 画布上的圆弧没有抗锯齿,android,surfaceview,Android,Surfaceview,我想在画布上画两个彩色的圆圈。一切都是对的,但圆圈并不平滑。 这就是效果: 这是代码: 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, getPaintW
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;
}
请参见中的,我尝试了这两种解决方案以及
Paint.setAntiAlias(true)
(单独和一起)并且它对我的扫描梯度
没有影响。还有其他想法吗?
paint.setFlags(Paint.ANTI_ALIAS_FLAG)