我旋转的 TextView 被截断了。我必须做什么?
My rotated TextView is cut off. What i have to do?
这是我的布局
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<!--left-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="10dp"
android:layout_weight="1"
android:background="@color/nero"
android:orientation="vertical">
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Nothing important"
android:textSize="40dp"/>
</LinearLayout>
<!--right yellow column-->
<LinearLayout
android:id="@+id/layout_barra_nord"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="6"
android:background="@color/giallo"
android:orientation="vertical">
<TextView
android:paddingTop="20dp"
android:background="@android:color/background_light"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:rotation="90"
android:singleLine="true"
android:gravity="center"
android:layout_gravity="bottom"
android:textColor="@color/nero"
android:textSize="30sp"
android:textStyle="bold"
android:text="try"
/>
<!--android:text="long text"-->
</LinearLayout>
</LinearLayout>
</LinearLayout>
我想对每个文本都有这种效果:
但是如果我尝试添加更长的文本,我的文本将被截断:
我看到很多人都有这个问题,但我没有找到任何有用的东西。
如何解决这个问题?
更改TextView的以下属性
android:layout_height="wrap_content"
至
android:layout_height="match_parent"
以便它向下延伸到完整的父级高度。
您的 TextView width
是 match_parent
,这意味着您的 TextView
将与您的 parent LinearLayout
具有相同的 width
。您的 LinearLayout
宽度较窄,因此您的 TextView
宽度也会较窄。
编辑: 你必须把你的 TextView
想成他和你的 parent[=] 处于相同的方向 25=]。如果他有相同的方向,你会得到宽度较窄的 TextView。
这是我的布局
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<!--left-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="10dp"
android:layout_weight="1"
android:background="@color/nero"
android:orientation="vertical">
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Nothing important"
android:textSize="40dp"/>
</LinearLayout>
<!--right yellow column-->
<LinearLayout
android:id="@+id/layout_barra_nord"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="6"
android:background="@color/giallo"
android:orientation="vertical">
<TextView
android:paddingTop="20dp"
android:background="@android:color/background_light"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:rotation="90"
android:singleLine="true"
android:gravity="center"
android:layout_gravity="bottom"
android:textColor="@color/nero"
android:textSize="30sp"
android:textStyle="bold"
android:text="try"
/>
<!--android:text="long text"-->
</LinearLayout>
</LinearLayout>
</LinearLayout>
我想对每个文本都有这种效果:
但是如果我尝试添加更长的文本,我的文本将被截断:
我看到很多人都有这个问题,但我没有找到任何有用的东西。 如何解决这个问题?
更改TextView的以下属性
android:layout_height="wrap_content"
至
android:layout_height="match_parent"
以便它向下延伸到完整的父级高度。
您的 TextView width
是 match_parent
,这意味着您的 TextView
将与您的 parent LinearLayout
具有相同的 width
。您的 LinearLayout
宽度较窄,因此您的 TextView
宽度也会较窄。
编辑: 你必须把你的 TextView
想成他和你的 parent[=] 处于相同的方向 25=]。如果他有相同的方向,你会得到宽度较窄的 TextView。