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
will not support in Html.fromHtml
. can aybody tell is ther any other way to achieve this?
Add Line Breaks to a TextView Just add a \n to your text. This can be done directly in your layout file, or in a string resource and will cleanly break the text in your TextView to the next line.
<br>: The Line Break element. The <br> HTML element produces a line break in text (carriage-return). It is useful for writing a poem or an address, where the division of lines is significant.
To add a line break to your HTML code, you use the <br> tag. The <br> tag does not have an end tag. You can also add additional lines between paragraphs by using the <br> tags. Each <br> tag you enter creates another blank line.
Just try: Textview_name. settext("something \n new line "):
Did you try <br/>
, <br><br/>
or simply \n
? <br>
should be supported according to this source, though.
Supported HTML tags
<br>
worked for me.
simply add + "<br />" +
is enough for a line break
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With