Search code examples
androidandroid-layoutandroid-controls

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


Solution

  • 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