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.
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With