0

Possible Duplicate:
Vertical (rotated) label in Android.
How to make a TextView Text vertical

Have can I arrange vertically the text of the TextView.Just like the follow picture,sorry,I am no allow to posting my image!

Community
  • 1
  • 1
HeyNine
  • 21
  • 2

3 Answers3

1
 <TextView
    android:layout_width="wrap_content"
    android:layout_height="fill_parent"
    android:text="a\nn\nd\nr\no\ni\nd" />

Try this. put \n after each character.

Nirav Tukadiya
  • 3,367
  • 1
  • 18
  • 36
0

You can override setText method of the TextView, and can insert \n between each character. As following example:

public void setText(CharSequence str)
{
    StringBuffer buffer=new StringBuffer();
    for(int i=0; i<str.length(); i++)
    {
          buffer.append(str.charAt(i));
          buffer.append("\n");
     }
     buffer.setLength(buffer.length()-1);
     super.setText(buffer.toString());
}
jeet
  • 29,001
  • 6
  • 52
  • 53
  • Thanks, I have tried it.I think I should overwrite the TextView so that it can arrange vertical its text. – HeyNine Dec 04 '12 at 06:49
0

solution given by others are absolutely perfect but there is a other way

 <TextView
    android:layout_width="2sp"   /* width of one character width*/
    android:layout_height="fill_parent"
    android:text="a\nn\nd\nr\no\ni\nd" 
    android:singleLine="false"
    />
Mohd Mufiz
  • 2,236
  • 17
  • 28
  • Thanks! I have found the solution. http://stackoverflow.com/questions/1258275/vertical-rotated-label-in-android – HeyNine Dec 04 '12 at 06:52