0

Possible Duplicate:
How to add a line break in an Android TextView?

I'm trying to express a number with a superscript and other text in three different lines but the line break doesn't work for some reason.

TextView tvAnswer = (TextView)findViewById(R.id.textView_answer);
tvAnswer.setText(Html.fromHtml("16<sup>4</sup>" + "istext \nistextonanotherline"));

The " \n" doesn't cause a line break but it does without the "Html.fromHtml" which I need.

This also doesn't work:

tvAnswer.setText(Html.fromHtml("16<sup>4</sup>" + "istext<br>istextonanotherline"));

since Android apparently doesn't support the br HTML tag. Help?

Community
  • 1
  • 1
user1246462
  • 1,228
  • 3
  • 11
  • 20
  • You'll want to take a look at the following thread: http://stackoverflow.com/questions/5382490/how-to-add-a-line-break-in-an-android-textview – Chirag Shah Aug 31 '12 at 23:26
  • Yes, but I'm not really sure if there's a better way to do the break than "CDATA". – user1246462 Aug 31 '12 at 23:32

1 Answers1

1

One possible solution is

tvAnswer.setText(Html.fromHtml("16<sup>4</sup>" + "istext "));
    tvAnswer.append("\n");
wtsang02
  • 18,603
  • 10
  • 49
  • 67