[英]android rotated TextView inherits the parent's width
好吧,经过几个小时的网络搜索但没有结果,或者有人写课程来做到这一点,并且在发布问题后仅 30 分钟,我就设法实现了我想要的。
我将 TextView 放在 FrameLayout 中,现在它不继承其父宽度。 还给了它一个方形比例和一个layout_gravity,代码如下:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="20dp"
android:layout_height="wrap_content">
<TextView
android:id="@+id/text"
android:layout_width="120dp"
android:layout_height="120dp"
android:rotation="-90"
android:text="january"
android:textSize="14sp"
android:gravity="center|right"
android:layout_gravity="top|center"
android:paddingRight="8dp"
android:background="@color/itemMainBgColor"/>
</FrameLayout>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.