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:

the effect that always I want

but if I try to add a longer text, my text will be cut off:

cut effect

I see that lot of people have this problem, but I haven't found anything helpful. How to fix this problem?

2 Answers

1
luiscosta On Best Solutions

Your TextView width is match_parent which means your TextView will have the same width as your parent LinearLayout. Your LinearLayout have a narrow width so your TextView will have a narrow width too.

EDIT: You have to think of your TextView as if he is on the same orientation as your parent. If he had the same orientation you would have the TextView with a narrow width.

0
Antonio Cappiello On

Change the following attribute of TextView

android:layout_height="wrap_content"

to

android:layout_height="match_parent"

so that it stretch down to the full parent height.