Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/207.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 画布上的圆弧没有抗锯齿_Android_Surfaceview - Fatal编程技术网

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)