How to have HTML New Line Feature in Android Text View?
String sBooks = "Books on Chennai:\n ....";
Replace: \n
with <br>
:
sBooks = sBooks.replace("\n", "<br>");
Example using a TextView:
myTextView.setText(Html.fromHtml(sBooks));
Just replace \n
with <br/>
tag and then pass the whole string to Html.fromHtml(String)
. By this it will be displayed in proper format.
You should replace this \n
with <br>
. For more android HTML
tags support go to Android Support HTML Tags or daniel-codes.blogspot.in