I want to draw text below circle in canvas. Following is my code but text is drawn above circle.
canvas.drawCircle(getWidth() / 2, getHeight() / 2, radius, paint);
canvas.drawText(text, 0, (radius*2), textPaint);
I want to draw text below circle in canvas. Following is my code but text is drawn above circle.
canvas.drawCircle(getWidth() / 2, getHeight() / 2, radius, paint);
canvas.drawText(text, 0, (radius*2), textPaint);
Looking at it properly you need to set the y value based on height of the canvas, same way you did the circle, then adjust it to be Below based on radius.
canvas.drawCircle(getWidth() / 2, getHeight() / 2, radius, paint);
canvas.drawText(text, 0, (getHeight() / 2) + radius, textPaint);
One thing that may be confusing you is that the origion is the top left. And that increase in Y is downwards
You may need to add a few extra pixels based on text height. so (getHeight() / 2) + radius + 20