开发者

Bug in Android rotated TextView?

开发者 https://www.devze.com 2023-03-19 01:41 出处:网络
Define a TextView element like this: <TextView android:id=\"@+id/rotate_text\" android:layout_width=\"wrap_content\"

Define a TextView element like this:

<TextView
    android:id="@+id/rotate_text"
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_alignParentBottom="true"
    android:text="This text string will behave strangely" 
    android:textSize="14sp"/>

Then give it the following rotation and observe what happens:

RotateAnimation rot90 = new RotateAnimation(0.0f, -90.0f);
rot90.setDuration(10000);
rot90.setFillAfter(true);
findViewById(R.id.rotate_text).setAnimation(rot90);

As the text rotates, it expands, contracts and sometimes loses one or two characters at the end. For a given angle, except 0 or 90 degrees, you won't know how long the text will end up, or even if all of it will be displayed开发者_如何学JAVA.

Is it supposed to be this way? And is there a workaround?

0

精彩评论

暂无评论...
验证码 换一张
取 消