Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

html

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?

like image 440
mohan Avatar asked Oct 18 '12 13:10

mohan


People also ask

How do I add a line break in Android?

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.

How do I put text on 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.

How do you show the next line of data in HTML?

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.

How do I make text go to the next line in Kotlin?

Just try: Textview_name. settext("something \n new line "):


3 Answers

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

Supported HTML tags

like image 112
ecem Avatar answered Oct 18 '22 07:10

ecem


<br> &nbsp; worked for me.

like image 8
mohan Avatar answered Oct 18 '22 06:10

mohan


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

like image 4
tom nobleman Avatar answered Oct 18 '22 07:10

tom nobleman