简体   繁体   English

如何在Android中绘制弯曲的文本

[英]How to draw curved text in Android

I'm trying to build a text editing app that allows the user to edit text using different fonts, colors, sizes, rotations, etc. I'm working on a feature that is supposed to curve the text but I've got no clue how to do it. 我正在尝试构建一个文本编辑应用程序,该应用程序允许用户使用不同的字体,颜色,大小,旋转度等来编辑文本。我正在研究一种可以使文本弯曲的功能,但是我没有任何线索怎么做。 I found this StackOverflow post HERE and searching through the comments, I found this post HERE but for what I'm trying to achieve, that is how I want it to end up. 我在这里找到了这个StackOverflow帖子,并在评论中进行了搜索,在这里找到了这个帖子,但是对于我想要实现的目标,这就是我想要的结局。 What I want it to do is start as a normal line of text and then based on the value of a seekbar I want it to curve, until it reaches the MAX value at which point it's in a circle (as seen in the second link). 我要执行的操作是从正常的文本行开始,然后基于我希望它弯曲的seekbar的值,直到它达到最大值(在第二个链接中看到)为止。 If you can help me figure out how to do this I would really appreciate it. 如果您能帮助我弄清楚该如何做,我将不胜感激。 I figure it's going to use path.addArc or something like that but I'm not sure. 我想这将使用path.addArc或类似的东西,但我不确定。

Thank you 谢谢

PS I'll post the images below just in case you don't want to go look at the links PS我将在下面发布图片,以防万一您不想看链接

图片1 图片2

您可以在自定义视图中绘制圆形文本,使用画布函数drawTextOnPath(String text,Path path,float hOffset,float vOffset,Paint paint),然后根据需要构造路径。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM