Reputation: 39470
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?
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.
Upvotes: 5
Views: 1595
Reputation: 12121
Views in Android are rectangular so you'll have to use Canvas and Paint to achieve your goal. Take a look at API Demos in the SDK samples. There is one entry called Graphics/Text Align which shows text drawn along a curving path.
Upvotes: 2
Reputation: 1746
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);
}
Please have a look Draw text in circular view?
How to Show Circular Text using TextView in Android
Upvotes: 3