Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display a text vertically or rotate a TextView in layout XML file?

I want to display a string vertically in a view as below, is there have a way to implement that in layout XML file?

enter image description here

like image 997
sunjinbo Avatar asked Sep 14 '16 11:09

sunjinbo


2 Answers

To rotate the textview in xml use : android:rotation="-90"

<TextView
    android:id="@+id/textView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Hello World!"
    android:rotation="-90"/>

Example image

like image 105
Janishar Ali Avatar answered Sep 28 '22 20:09

Janishar Ali


add attributes in Text view android:rotation="-90"

    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:rotation="-90"
    android:text="Hello World!" />
like image 25
UJWAL GHONGADE Avatar answered Sep 28 '22 22:09

UJWAL GHONGADE