I need to display some strings that require both different font colors and arguments within.
I've been using CDATA
within the string resources and HtmlCompat.fromHtml
e.g
<string name="my_string"><![CDATA[My string counts <font color="#FF544B">%s times</font> but sadly \n\n no spacing]]></string>
HtmlCompat.fromHtml(resources.getString(R.string.my_string, count), HtmlCompat.FROM_HTML_MODE_COMPACT)
My problem is that \n\n
doesn't create the extra new line/spacing I need.
I know I can solve this problem by having two different strings with two TextViews
and add that spacing between them but there should be a way to add extra new lines/spacing within [CDATA[...]]
, right?
` instead `\n` ? – Selvin Mar 23 '23 at 10:08
` worked, thank you! – petrrr33 Mar 23 '23 at 10:43