Android的 - 是否有可能扭曲一个TextView? [英] Android -- Is it possible to warp a TextView?
问题描述
我想翘曲一个TextView与弧形。我知道这是可能的变形的图像,但有可能产生翘曲TextViews?是否有这样做的一个既定模式?
I'd like to warp a TextView with an arc shape. I know it's possible to warp images, but is it possible to warp TextViews? Is there a established pattern for doing so?
我的另一种选择是扭曲的文字在Photoshop中,具有透明背景保存,并使用ImageView的,但客户想要在大约10位完成这件事,我想如果我能,以避免额外的资源。
My other option is to warp the text in Photoshop, save it with a transparent background, and use an ImageView, but a client wants this done in about 10 places and I'd like to avoid the extra resources if I can.
推荐答案
您需要使用customView,重写的onDraw(),创建一个路径并使用drawTextOnPath。
You need to use customView, override the onDraw(), create a path and use drawTextOnPath.
@Override onDraw(Canvas canvas){
Path mPath = new Path();
mPath.addCircle(x, y, 200, Path.Direction.CW);
canvas.drawTextOnPath(textToDraw, mPath, textX, textY, paint);
}
请看看圆形视图中绘制文本?
<一个href=\"http://stackoverflow.com/questions/13153201/how-to-show-circular-text-using-textview-in-android\">How为显示在Android中使用TextView的通知文本
这篇关于Android的 - 是否有可能扭曲一个TextView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!