4

I want a vertical label for my app. Is there a property to make text vertical? Here's what I mean vertical label:

S
t
a
c
k
o
v
e
r
f
l
o
w

thanks ahead.

jayellos
  • 691
  • 1
  • 14
  • 32
  • 1
    You might need to do it your self by extending a view or textview and overriding the onDraw method. – blessanm86 Apr 12 '12 at 03:59
  • 1
    I think you can find your answer here http://stackoverflow.com/questions/1258275/vertical-rotated-label-in-android – Ajay Apr 12 '12 at 04:51

3 Answers3

4

A simple solution may be to insert a \n after each character, and make sure that the the height is set to fill_parent.

Abdullah Jibaly
  • 53,220
  • 42
  • 124
  • 197
  • 1
    thank you, it works. I also have a solution, in setting textView text i use Html.fromHtml(), and I traverse every letter and insert
    tag then set the textView Text.
    – jayellos Apr 12 '12 at 05:08
1

Add \n after every letter. In the layout xml it won't appear right, but running it to an actual device or emulator will appear correct.

 <TextView
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:text="h\ne\nl\nl\no\n w\no\nr\nl\nd" />

you can set the layout_height to wrap_content as well.

Mark Pazon
  • 6,167
  • 2
  • 34
  • 50
0

Also another option if you only need one line of text and have a fixed-width typeface (monospace or Asian fonts):

Limit the TextView width to fit just one character. The height can be wrap_content.

blub
  • 8,757
  • 4
  • 27
  • 38