Android Question Circular Text in Canvas?


Active Member
Licensed User
I had a request from a friend, to design a simple circular stamp that include the circle, of course, and the text surrounding the inner circle, and maybe something in the center.
I can do that, but no the circular text one.
Does anybody has something like that? thanks


Staff member
Licensed User

Sub Activity_Create(FirstTime As Boolean)
   Dim cvs As Canvas
   Dim path As Path
   path.Initialize(50%x, 50%y)
   Dim radius As Float = 100dip
   PathAddCircle(path, 50%x, 50%y, radius)
   cvs.DrawPath(path, Colors.Red, False, 2dip)
   DrawTextOnPath(cvs, path, "Circular Text!!!", Typeface.DEFAULT, 18, Colors.White, radius)
End Sub

Sub PathAddCircle(path As Path, x As Float, y As Float, radius As Float)
   Dim jo As JavaObject = path
   jo.RunMethod("addCircle", Array(x, y, radius, "CW"))
End Sub

Sub DrawTextOnPath(canvas As Canvas, path As Path, text As String, typeface1 As Typeface, TextSize As Float, Color As Int, Radius As Float)
   canvas.DrawText("", 0, 0, typeface1, TextSize, Color, "CENTER")
   Dim jo As JavaObject = canvas
   Dim r As Reflector
   r.Target = canvas
   r.Target = r.GetField("paint")
   jo = jo.GetField("canvas")
   Dim hoffset = Radius * 2 * cPI / 4, voffset = -10dip As Float
   jo.RunMethod("drawTextOnPath", Array(text, path, hoffset, voffset, r.Target))
End Sub


Licensed User
Is it possible to get the same effect at the bottom of the circle? I was able to move the text to the bottom of the circle, but the words ended up backwards and upside down. I believe they followed the path as they were meant to do.