旋转后如何获取TextView的精确点(Rect)

时间:2012-10-02 05:16:44

标签: android rotation textview

我正在尝试在textview中获取文本的确切位置,当旋转为0',180',360'

时,我已通过此代码获取文本在textview中的位置

fTranslationX和fTranslationY是MOtionEvent的event.getX和event.getY

    Rect rect = new Rect();
    rect.left = (int) fTranslationX;
    rect.top = (int) fTranslationY;
    rect.right = (int) (fTranslationX + getTextWidth());
    rect.bottom = (int) (fTranslationY + getLineHeight());

我的TextView是自定义的,所以在旋转之后我无法获得旋转的Rect,我的文本被旋转但是Rect保持在相同的点! 如何在TextView中获取旋转文本的Rect(TextView的width = height = fill_parent)

任何想法?

0 个答案:

没有答案
相关问题