protected override void OnDraw(Canvas canvas) { base.OnDraw(canvas); Paint redPaint = new Paint(); redPaint.Color = Color.Red; redPaint.SetStyle(Paint.Style.Fill); float centerX = canvas.Width / 2; float centerY = canvas.Height / 2; canvas.DrawCircle(centerX, centerY, 50, redPaint); }
protected override void OnDraw(Canvas canvas) { base.OnDraw(canvas); Paint blackPaint = new Paint(); blackPaint.Color = Color.Black; blackPaint.StrokeWidth = 5; blackPaint.SetStyle(Paint.Style.Stroke); Paint whitePaint = new Paint(); whitePaint.Color = Color.White; whitePaint.SetStyle(Paint.Style.Fill); float x = 100; float y = 200; canvas.DrawCircle(x, y, 25, blackPaint); canvas.DrawCircle(x, y, 25, whitePaint); }In both examples, the DrawCircle method is used to create a circle on the canvas. The first parameter is the x-coordinate of the center of the circle, the second parameter is the y-coordinate of the center of the circle, and the third parameter is the radius of the circle. The fourth parameter is the paint object used to fill or stroke the circle.