旋转的TextView不切断文本 [英] Rotate TextView without cut off text

查看:132
本文介绍了旋转的TextView不切断文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图旋转一个TextView,但我的文字得到由边界切断。但文字旋转。
我不使用本作的动画或某种。这只是静态的,在设计方面:)

i'm trying to rotate a TextView, but my text gets cut off by the bounds. But the text is rotated. I'm not using this for an animation or some sort. It's just static, design-wise :)

我有一个RotatedTextView在那里我做到这一点:

I have a RotatedTextView where i do this:

public class RotatedTextView extends TextView
@Override
public void onDraw(Canvas canvas)
{
    canvas.save(); 
    float py = this.getHeight()/2.0f;
    float px = this.getWidth()/2.0f;
    px = py = 0;
    canvas.rotate(this.degrees, px, py); 
    super.onDraw(canvas); 
    canvas.restore(); 
}

下面是如何它现在正在寻找:

Here's how it is looking now:

Orginial源

谁能帮我解决这个问题?

Can anyone help me solve this issue ?

谢谢!

推荐答案

尝试添加填充到TextView的。这应该让画布保持在边界内。或者,你可能需要把相应的视图的高度。

Try add padding to the textview. That should make the canvas remain inside the bounds. Or you might need to put the height of the view accordingly.

这篇关于旋转的TextView不切断文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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