Solution 1 :
Is it OK for you to use it like this without using spans.
String text = "normal text here<font color=#fc4903>this should be red</font> <font color=#ffcc00>but this should be yellow</font><font color=#fc4903>and more red text</font>now normal text ";
textview.setText(Html.fromHtml(text))
Sorry if I misled you.
Problem :
I want to use HTML to color segments in a TextView. I have:
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));
However the text “but this should be yellow” is still red. I even tried
<span style='color: yellow !important'>
And it’s still red. How can I enforce the yellow part?