Android 旋转 TextView 中的错误?
像这样定义一个 TextView 元素:
<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"/>
然后对其进行以下旋转并观察会发生什么:
RotateAnimation rot90 = new RotateAnimation(0.0f, -90.0f);
rot90.setDuration(10000);
rot90.setFillAfter(true);
findViewById(R.id.rotate_text).setAnimation(rot90);
随着文本旋转,它会扩展、收缩,有时会在末尾丢失一两个字符。对于给定的角度(0 度或 90 度除外),您将不知道文本最终会持续多长,或者即使会显示全部文本。
应该是这样吗?有解决方法吗?
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.
Is it supposed to be this way? And is there a workaround?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论