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("<b>" + st + "<\b>" + "\n" + cursor.getString(1)));
ive also tried
b.setText(Html.fromHtml("<b>" + st + "<\b>" + "<br/>" + cursor.getString(1)));
the second one works but both lines are bolded.
Thanks in advance
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.
text. HTML that processes HTML strings into displayable styled text and then we can set the text in our TextView. We can also use WebView for displaying HTML content. Currently Android does not support all the HTML tags but it supports all major tags.
Add \t for tab and \n for new line.
wrong end tag:
b.setText(Html.fromHtml("<b>" + st + "</b>" + "<br/>" + cursor.getString(1)));
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