【发布时间】:2020-07-28 13:45:11
【问题描述】:
我想使用 HTML 为 TextView 中的段着色。我有:
String myText = "normal text here <span style='color: red'> this should be red <span style='color: yellow'>but this should be yellow </span> and more red text </span> now normal text";
textView.setText(Html.fromHtml(myText, 0));
但是“但这应该是黄色的”文本仍然是红色的。我什至尝试过
<span style='color: yellow !important'>
它仍然是红色的。我怎样才能强制执行黄色部分?
【问题讨论】: