Android Html.fromHtml(String) doesn't work for text

后端 未结 12 1542
逝去的感伤
逝去的感伤 2020-12-23 19:32

I am trying to add lines with different colors to my TextView using html tags.

For whatever reason,

    Html.fromHtml(\"

        
12条回答
  •  北荒
    北荒 (楼主)
    2020-12-23 20:14

    txt_description1.setText(Html.fromHtml(""+str_description1+""));
    

    If you do not want a single static color and want to directly reflect from editor you can use "rgb". It will reflect the exact color what you have set in editor, just set in textview and concat it with textview value. And you are all set to go.

提交回复
热议问题