Android Html.fromHtml()在嵌套文本样式上无法正常工作

Abo*_*ade 6 html android

我想显示HTML

"<html><body><font color=\"black\">
In the name of <font color=\"blue\"><b> God</b></font>
the compassionate, the merciful</font></body><html>"
Run Code Online (Sandbox Code Playgroud)

在TextView中.所以我使用过Html.fromHtml(),但与浏览器相比输出有所不同.

不同之处在于TextView中的"God"一词并未显示为蓝色.

码:

textView.setText("<html><body><font color=\"black\">
  In the name of <font color=\"blue\"><b> God</b></font>
  the compassionate, the merciful</font></body><html>");
Run Code Online (Sandbox Code Playgroud)

Nir*_*ara 0

Html.fromHtml(String)不支持所有 HTML 标签

允许的 HTML 标签列表:

  • br
  • p
  • 分区
  • 强的
  • dfn
  • 大的
  • 小的
  • 字体
  • 块引用
  • TT
  • A
  • 超级

  • 然后,问题不在于支持哪些标签。 (2认同)