Skip to content Skip to sidebar Skip to footer

How Do I Add A New Line In Html Format In Android?

I have to add text to a button bolding the first line and unbolding the second but i cant figure out which new line character it is. b.setText(Html.fromHtml('' + st + '<

Solution 1:

wrong end tag:

b.setText(Html.fromHtml("<b>" + st + "</b>" + "<br/>" + cursor.getString(1)));

Solution 2:

Rather than using HTML to format your text (which is relatively slow) you could use Spans which give you much tighter control, and are more efficient. I wrote a blog post about the use of spans which may help you to get started.

Post a Comment for "How Do I Add A New Line In Html Format In Android?"