[英]Canvas drawText, how to rotate and how to change “anchor-point”?
Good evening, 晚上好,
It is about an android app. 这是关于一个Android应用程序。
I would like to use the method Canvas.drawText(...). 我想使用Canvas.drawText(...)方法。 But I don't know how I can rotate the text.
但是我不知道如何旋转文本。 I need the text at a certain position at a certain angle.
我需要在特定位置,特定角度的文本。 Do you know how I can achieve this?
你知道我怎么能做到吗?
Next question, usually the point to which the position coordinates are refering is the lower left corner. 下一个问题通常是位置坐标所指的点是左下角。 I want to change this "anchor-point" to the lower center.
我想将此“锚点”更改为较低的中心。 Is that possible?
那可能吗? The pivot-point of the rotation should be the same.
旋转的枢轴点应该相同。
I guess simple questions, but I don't know how to do this. 我猜很简单的问题,但我不知道该怎么做。 Thanks for help.
感谢帮助。
here is a basic example of drawing text on a path, to get it how you want you should mess with the path and the paint Path , Paint 这是在路径上绘制文本的基本示例,以获取想要的方式,您应该弄乱路径和绘画Path , Paint
Paint paint = new Paint();
Path path = new Path();
paint.setColor(Color.BLACK);
path.moveTo(canvas.getWidth()/2, 0);
path.lineTo(canvas.getWidth()/4, 400);
canvas.drawTextOnPath("text manipulated", path, 0, 0, paint);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.