开发者

Canvas.drawText Right to Left in Java

开发者 https://www.devze.com 2023-02-22 17:19 出处:网络
How can I output text Right to Left (i.e. in reverse order) using Canvas.drawText ? Is开发者_C百科 there a way?Set Paint.Align property in your textPaint object, if you set it RIGHT -- The text is dra

How can I output text Right to Left (i.e. in reverse order) using Canvas.drawText ? Is开发者_C百科 there a way?


Set Paint.Align property in your textPaint object, if you set it RIGHT -- The text is drawn to the left of the x,y origin:

textPaint.setTextAlign(Paint.Align.RIGHT);
canvas.drawText("your text here", getRight(), getY()/2, textPaint);


Check this out: How to draw RTL text (Arabic) onto a Bitmap and have it ordered properly?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号