画出圆形视图文字? [英] Draw text in circular view?

查看:118
本文介绍了画出圆形视图文字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要画一个字符串说,在圆形的意见计算器像下图可以任何一个建议如何做到这一点。同时,我需要点击每个characer事件。

I want to draw a string say "stackoverflow" in circular view like below image can any one suggest how to do it. And also i need click event on each characer.

推荐答案

您需要为这是一个自定义视图。在OnDraw的方法,创建一个路径对象,添加圆的物体,然后使用Canvas对象到路径上绘制文本。

You need to make a customized view for this. in onDraw method, create a path object, add circle to that object, and then use Canvas Object to draw text on that path.

Path path = new Path();
path.addCircle(x, y, radius, Path.Direction.CW);
myCanvas.drawTextOnPath(myText, path, offset, 0, myPaint);

编辑:

使用OS 4.0及以上时,使用该行的code:

use this line of code when using os 4.0 and above:

setLayerType(View.LAYER_TYPE_SOFTWARE, null);

这篇关于画出圆形视图文字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆