我正在用 canvas.drawArc(...) 绘制弧线,并使用下面的代码向绘制对象添加渐变,但渐变只应用于弧线而不是笔划。如何绘制渐变笔触?
paint = new Paint();
paint.setStyle(Paint.Style.STROKE);
paint.setStrokeWidth((float) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 50, getResources().getDisplayMetrics()));
paint.setShader(new RadialGradient(getWidth()/2,getHeight()/2,mRadius/2,Color.BLUE,Color.YELLOW, Shader.TileMode.CLAMP));
canvas.drawArc(new RectF(getWidth()/2-mRadius, getHeight()/2-mRadius, getWidth()/2+mRadius, getHeight()/2+mRadius),270f,mProgressDegree,true,paint);