Reputation: 587
I have this situation in my strings.xml.
<string name="mensagem">Olá <b><i> {0} </i></b>,</string>
And in my code I do this:
string msg = String.Format(Resources.GetString(Resource.String.mensagem).ToString(), cliente.Nome.ToUpper());
lblNome.Text = Html.FromHtml(msg).ToString();
But the style tags (b,i) do not work. I need to concatenate words with and without style, so I need to do it in this way. I cant use setTypeface
because I need to style individual words and after that, join those words on a sentence.
What is the way ?
Regards, Marcelo.
Upvotes: 3
Views: 1598
Reputation: 8380
You need to change your code to the following.
string msg = String.Format(Resources.GetString(Resource.String.mensagem).ToString(), cliente.Nome.ToUpper());
lblNome.TextFormatted = Html.FromHtml(msg);
Html.FromHtml(string).ToString()
is just converting the formatted ISpannable
back to a string so you are losing the formatting.
Upvotes: 6