show multiple lines of text?


  1. mathkid95

    mathkid95 Member

    Hello,

    How do you use a TextView to show multiple lines of text in android?
    I tried doing android:singleLine = "false" but that's not working

    Here is my code


    for(int i = 1; i <= 10; i++)
    {
    tv.setText("instant " + i + ": ");
    }

    so it should say

    instant 1:
    instant 2:
    instant 3:
    instant 4:
    instant 5:
    instant 6:
    instant 7:
    instant 8:
    instant 9:
    instant 10:

    BUT, the emulator only showing

    instant 10:


    How can I achieve this? Thanks!

    Advertisement
    :
  2. handrdoid

    handrdoid New Member

    that's impossible dude..
    alostpacket likes this.
  3. alostpacket

    alostpacket Over Macho Grande? VIP Member

    uh lol ^

    just do this:

    Edit: err sorry needed coffee before i wrote that.

    full code:
    Code (Text):
    1.  
    2.  
    3. String myString ="";
    4.  
    5. for ( int i=0; i <= 10; i++ )
    6. {
    7.     myString += "instant " + i + ":\n";
    8. }
    9.  
    10. tv.setText(myString);
    11.  
    \n is the unix newline character
Loading...

Share This Page