Is it possible to have multiple styles inside a TextView?

后端 未结 18 1863
醉梦人生
醉梦人生 2020-11-21 17:34

Is it possible to set multiple styles for different pieces of text inside a TextView?

For instance, I am setting the text as follows:

tv.setText(line         


        
18条回答
  •  长发绾君心
    2020-11-21 18:13

    Try Html.fromHtml(), and mark up your text with bold and italic HTML tags e.g:

    Spanned text = Html.fromHtml("This mixes bold and italic stuff");
    textView.setText(text);
    

提交回复
热议问题