mohan
mohan

Reputation: 13165

How to start new line with space for next line in Html.fromHtml for text view in android

Could anyone tell me how to start new line with space for next line in Html.fromHtml for text view in android? I used <br> tag for next line; I can't achieve to give space because &nbsp; will not support in Html.fromHtml. can aybody tell is ther any other way to achieve this?

Upvotes: 15

Views: 157211

Answers (5)

Trojan Horse
Trojan Horse

Reputation: 213

use <br/> tag

Example:

<string name="copyright"><b>@</b> 2014 <br/>
Corporation.<br/>
<i>All rights reserved.</i></string>

Upvotes: -5

Trojan Horse
Trojan Horse

Reputation: 213

Enclose your text in
--Here-- with the space you want in new line. save it in a String variable then pass it in Html.fromHtml().

Upvotes: -2

mohan
mohan

Reputation: 13165

<br> &nbsp; worked for me.

Upvotes: 8

tom nobleman
tom nobleman

Reputation: 366

simply add + "<br />" + is enough for a line break

Upvotes: 4

ecem
ecem

Reputation: 3614

Did you try <br/>, <br><br/> or simply \n ? <br> should be supported according to this source, though.

Supported HTML tags

Upvotes: 25

Related Questions