ivan ivan - 1 month ago 6
Android Question

How to change text background inside in xml

Let say I have next code in strings XML, which is working fine and text color become blue on output

<string name="hello_world">
<font color='blue'> Hello world!</font> here is my text with yellow background
</string>


Question - Is it possible to change text background for some worlds in similar way as above, directly inside in xml string ?

Final result:

enter image description here

Answer

Sure, Check this:

<string name="hello_world">
<font color='blue'> Hello world!</font><font color = 'black' bgcolor = 'yellow'> here is my text with yellow background</font>
</string>
Comments