John Roberts
John Roberts

Reputation: 5976

Inline XML Bolding Not Working

The following has no effect:

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

Getting the string like this:

        sectionDetails = getResources().getString(resID);

Anyone know what's wrong?

Upvotes: 1

Views: 54

Answers (1)

ozbek
ozbek

Reputation: 21183

Use getText() instead of getString() as the latter will strip out styled text information.

public CharSequence getText (int id)

Return the string value associated with a particular resource ID. The returned object will be a String if this is a plain string; it will be some other type of CharSequence if it is styled.

vs

public String getString (int id)

Return the string value associated with a particular resource ID. It will be stripped of any styled text information.

Upvotes: 2

Related Questions