Html tags inside strings.xml is not working with Kotlin


#1

While trying to define the color in strings file like below it is working fine using java

 <string name="price_value">Rp %1$s &lt;font color=\"#f8011e\">(-%2$s)&lt;/font></string>

and the above string is getting used like that in my java code:

Html.fromHtml(String.format(
              getString(R.string.price_value),
              price,
              discount + "%"
            ));

But the same string is not working with Kotlin. Below is the code for Kotlin

Html.fromHtml(String.format(
              getString(R.string.price_value),
              price,
              discount + "%"
            ))

This string was supposed to change the color of 2nd dynamic parameter but its only working in java but Kotlin it’s not changing the color.