How do i add a new line in html format in android?

前端 未结 2 1602
悲哀的现实
悲哀的现实 2021-01-18 21:21

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(         


        
2条回答
  •  孤街浪徒
    2021-01-18 22:01

    Rather than using HTML to format your text (which is relatively slow) you could use Spans which give you much tighter control, and are more efficient. I wrote a blog post about the use of spans which may help you to get started.

提交回复
热议问题