10

I want to draw a string say "stackoverflow" in circular view like below image can any one suggest how to do it. And also i need click event on each characer.

IMAGE

Shankar Agarwal
  • 34,573
  • 7
  • 66
  • 64

2 Answers2

11

You need to make a customized view for this. in onDraw method, create a path object, add circle to that object, and then use Canvas Object to draw text on that path.

Path path = new Path();
path.addCircle(x, y, radius, Path.Direction.CW);
myCanvas.drawTextOnPath(myText, path, offset, 0, myPaint);

Edit:

use this line of code when using os 4.0 and above:

setLayerType(View.LAYER_TYPE_SOFTWARE, null);
Ali Imran
  • 8,927
  • 3
  • 39
  • 50
jeet
  • 29,001
  • 6
  • 52
  • 53
0

Take a look at both Path.addCircle and Canvas.drawTextOnPath API.

neevek
  • 11,760
  • 8
  • 55
  • 73