java在TextView中的旋转问题
我的问题是我想在FrameLayout
内旋转TextView
,但我不能旋转FrameLayout
当我将TextView
旋转90度时,它与父对象不匹配!
但我需要给所有家长发短信
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:安卓="http://schemas.安卓.com/apk/res/安卓"
xmlns:app="http://schemas.安卓.com/apk/res-auto"
安卓:id="@+id/FLback"
安卓:layout_width="match_parent"
安卓:layout_height="match_parent">
<FrameLayout
安卓:id="@+id/FLitem"
安卓:layout_width="match_parent"
安卓:layout_height="match_parent"
安卓:layout_margin="1dp">
<TextView
安卓:id="@+id/TVitem"
安卓:layout_width="match_parent"
安卓:layout_height="match_parent"
安卓:layout_margin="4dp"
安卓:background="@color/colorPrimaryDark"
安卓:gravity="center"
安卓:rotation="90"
安卓:text="TEXT"
安卓:textColor="@安卓:color/black"
安卓:textSize="10sp" />
</FrameLayout>
</FrameLayout>
这里有一个问题的例子:
一张照片中的问题
谢谢
# 1 楼答案
谢谢你的帮助
我找到的解决方案是测量整个视图并更改Textview的大小
谢谢
# 2 楼答案
问题是Android首先会测量视图,然后才会旋转视图。所以,我想你仍然应该旋转你的文本视图,但是如果你想要一个好的背景,你应该为父视图设置背景