show multiple lines of text?


Last Updated:

  1. mathkid95

    mathkid95 Member This Topic's Starter

    Joined:
    May 29, 2010
    Messages:
    21
    Likes Received:
    0
    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

    Joined:
    Apr 16, 2011
    Messages:
    1
    Likes Received:
    1
    that's impossible dude..
     
    alostpacket likes this.
  3. alostpacket

    alostpacket Over Macho Grande? VIP Member

    Joined:
    Nov 29, 2009
    Messages:
    7,978
    Likes Received:
    3,603
    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
     

Share This Page

Loading...