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

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

    That looks like a very dark color, are you sure that your screen is capable to display such colors, so you can distinguish them from black? The code snippet looks good, I've tried similar code many times and it worked like a charm. Try it with somewhat brighter, i.e. #ff0000 (red), to verify that it works:

    TextView text = ... // find or instantinate your text view.
    text.setText(Html.fromHtml("text"));
    

提交回复
热议问题