Caroline Caroline - 1 year ago 79
Java Question

Bold words in a string of strings.xml in Android

I have a long text in one of the strings at strings.xml. I want to make bold and change the color of some words in that text.

How can I do it?

thanks in advance

Answer Source

You could basically use html tags in your string resource like:

    <string name="styled_welcome_message">We are <b><i>so</i></b> glad to see you.</string>

And use Html.fromHtml or use spannable, check the link I posted.

Old similar question: Is it possible to have multiple styles inside a TextView?