Draw an arc with a SweepGradient in Android

前端 未结 1 1291
深忆病人
深忆病人 2021-02-09 04:10

How can I draw an arc using a Shader such as SweepGradient?

The examples I have all take a Paint object:

Paint lightRed = new Paint();
lightRed.setAntiAl         


        
相关标签:
1条回答
  • 2021-02-09 05:04

    Try this:

    Shader gradient = new SweepGradient (0,getMeasuredHeight()/2, Color.RED, Color.WHITE);
    lighted.setShader(gradient);
    canvas.drawArc(rectf, -90, 360, false, lightRed);
    

    You can modify the position and color values.

    0 讨论(0)
提交回复
热议问题