Draw text at an angle (e.g. upside down) on Android

I am trying to create a custom watch view in Android. See Image http://twitpic.com/1devk7

So far, to draw time and hour markers, I have used the Canvas.rotate method to get the desired effect. However, note that it is difficult to interpret the numbers in the lower half of the clock (for example, 6 or 9?) Due to the angle in which they are drawn.

When using drawText, is it possible to draw text at a speed of 45/90/180 degrees so that all the text looks upright when my onDraw method ends?

+4
source share
2 answers

To draw text rotated 90 degrees at the point (x, y), use this code:

canvas.save(); canvas.rotate(-90, x, y); canvas.drawText(text, x, y, paint); canvas.restore(); 
+30
source

Source: https://habr.com/ru/post/1306032/


All Articles