Guy Balas
Guy Balas

Reputation: 96

Android setText skip a line <br> /n \n

hello :) im trying to make my game type:

Current score: X

In : Y seconds (between them, skip a line.) Here is the code I tried to use:

changingTextView.setText("current score:"+counter+ \n- +"in"+TimeCounter+"seconds");

The \n or /n is not working to me.. I also tried :

changingTextView.setText("current score:"+counter+ <br> +"in"+TimeCounter+"seconds");

It is not working too..

Upvotes: 1

Views: 89

Answers (2)

Giru Bhai
Giru Bhai

Reputation: 14408

Try <br> as

changingTextView.setText(Html.fromHtml("current score:"+counter+ "<br>" +"in"+TimeCounter+"seconds"));

And make sure your \n is in "\n" for it to work.

changingTextView.setText("current score:"+counter+ "\n" + "-" +"in"+TimeCounter+"seconds");

Upvotes: 0

Shailendra Madda
Shailendra Madda

Reputation: 21551

Try this:

changingTextView.setText("current score:"+counter+ System.getProperty("line.separator") +"in"+TimeCounter+"seconds");

Upvotes: 2

Related Questions