Caroline Caroline - 10 months ago 65
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


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?