Is it possible to drawText vertically at custom View
?
If I write text like canvas.drawText("TEST", 0, 0, paint);
. The text will be printed horizontally on the canvas. How can I rotate it to vertical?
Thanks.
Asked
Active
Viewed 249 times
0

batuman
- 7,066
- 26
- 107
- 229
-
http://stackoverflow.com/questions/9262494/draw-text-vertically-on-canvas. check this might help – Raghunandan Jul 14 '13 at 03:40
-
Yeah thanks, I implemented in this way.canvas.save(); canvas.rotate(-90, x, y); canvas.drawText(date, x,y, paint); canvas.restore(); – batuman Jul 14 '13 at 05:06
1 Answers
0
I know it is too late but, it is unanswered so I have written.
You can use path to draw text on one path
private val path = Path()
path.moveTo(rect.centerX().toFloat(), height.toFloat())
path.lineTo(rect.centerX().toFloat(), 0F)
canvas.drawTextOnPath("Lalit jadav Lalit jadav Lalit jadav", path, 0F, 0F, textPaint)

Lalit Jadav
- 1,409
- 1
- 15
- 38