[英]My rotated TextView is cut off. What i have to do?
This is my layout这是我的布局
<?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>
i'd like to have this effect for every text:我想对每个文本都有这种效果:
but if I try to add a longer text, my text will be cut off:但如果我尝试添加更长的文本,我的文本将被截断:
I see that lot of people have this problem, but I haven't found anything helpful.我看到很多人都有这个问题,但我没有发现任何有用的东西。 How to fix this problem?
如何解决这个问题?
Your TextView width
is match_parent
which means your TextView
will have the same width
as your parent LinearLayout
.您的
TextView width
是match_parent
这意味着您的TextView
将与您的父LinearLayout
具有相同的width
。 Your LinearLayout
have a narrow width so your TextView
will have a narrow width too.您的
LinearLayout
宽度较窄,因此您的TextView
宽度也较窄。
EDIT: You have to think of your TextView
as if he is on the same orientation as your parent .编辑:您必须将您的
TextView
视为与您的 parent处于同一方向。 If he had the same orientation you would have the TextView with a narrow width.如果他有相同的方向,您将拥有宽度较窄的 TextView。
Change the following attribute of TextView更改 TextView 的以下属性
android:layout_height="wrap_content"
to到
android:layout_height="match_parent"
so that it stretch down to the full parent height.以便它向下延伸到完整的父高度。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.