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

sunjinbo picture sunjinbo · Sep 14, 2016 · Viewed 10.4k times · Source

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

Answer

Janishar Ali picture Janishar Ali · Sep 14, 2016

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