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

后端 未结 12 1454
逝去的感伤
逝去的感伤 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:10

    The fromHtml method is extremely limited in terms of the HTML tags that it supports, and font is not one of them. See http://commonsware.com/blog/Android/2010/05/26/html-tags-supported-by-textview.html for an unofficial list. I did some research on this myself, and I found that fromHtml is based on an obscure and poorly documented rendering engine.

提交回复
热议问题