1

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?

petrrr33
  • 583
  • 9
  • 24

0 Answers0