I have two words inside TextView :
Hello world.
Now I want to colorize world
to red color.
How I can do that ONLY in XML itself without using java code (without using Html.fromHtml()
as well)
In XML, we can set a text color by the textColor attribute, like android:textColor="#FF0000" .
You can use font tag in string.xml as
<string name="hello">Hello <font fgcolor="red">World</font></string>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With