How to draw circle by canvas in Android?

前端 未结 8 1301
广开言路
广开言路 2020-11-27 05:14

I want to draw circle by canvas. Here is my code:

[MyActivity.java]:

public class MyActivity extends Activity 
{
 public void onCreate(Bundle savedInst         


        
相关标签:
8条回答
  • 2020-11-27 05:34
    @Override
    public void onDraw(Canvas canvas){
        canvas.drawCircle(xPos, yPos,radius, paint);
    }
    

    Above is the code to render a circle. Tweak the parameters to your suiting.

    0 讨论(0)
  • 2020-11-27 05:38
        private Paint green = new Paint();
    
        private int greenx , greeny;
    
    
     green.setColor(Color.GREEN);
    
            green.setAntiAlias(false);
    
            canvas.drawCircle(greenx,greeny,20,green);
    
    0 讨论(0)
提交回复
热议问题