How to set two different text colors in a TextView in XML?

I have two words inside a TextView:

Hello world.

Now I want to colorize worldred. How can I do this ONLY in the XML itself without using java code (without using Html.fromHtml())

+4
source share
1 answer

You can use the font tag in string.xml as

<string name="hello">Hello <font fgcolor="red">World</font></string>
+5
source

Source: https://habr.com/ru/post/1656208/


All Articles