SpannableStringBuilder to create String with multiple fonts/text sizes etc Example?

后端 未结 9 1491
眼角桃花
眼角桃花 2020-11-28 03:00

I need to create a String placed in a TextView that will display a string like this:

First Part Not Bold BOLD rest not bold

9条回答
  •  南方客
    南方客 (楼主)
    2020-11-28 03:43

    Use HTML code in TextView using the Html class:

    Spanned styledText = Html.fromHtml("First Part Not Bold BOLD rest not bold");
    textView.setText(styledText);
    

提交回复
热议问题