Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android text view text in vertical direction

I have a Textview in which i am showing text 12345 now i want to show text

1
2
3
4
5

I tried rotation but it rotate my text and not giving the exact look.
I don't want to place \n tag in character.
I don't want customization.

like image 560
Connecting life with Android Avatar asked Dec 22 '11 13:12

Connecting life with Android


People also ask

How do I align text in text view?

android:gravity="center" for text center in TextView. android:gravity="center_horizontal" inner text if you want horizontally centered. android:gravity="center_vertical" inner text if you want vertically centered. android:layout_centerInParent="true" if you want TextView in center position of parent view.

What direction should text be vertical?

So, a good rule-of-thumb might be to favor the human nature option. That is, if the text is to be read ABOVE eye level, then it should run from bottom to top. If the text is to be read BELOW eye level, it should run from top to bottom.

How do I align text in Kotlin?

To center align text in TextView in Kotlin Android, set android:textAlignment attribute with the value “center” in layout file, or programmatically set the textAlignment property of the TextView object with View.


1 Answers

You could extend TextView to your custom VerticalTextView and override setText() method. In setText implementation you could iterate through text and modify it inserting linebreaks \n. After you finish just set result value to your view.

like image 120
woodshy Avatar answered Sep 27 '22 21:09

woodshy