title: How to format and style (Bold, TextSize) string resource in Android
body: <p><a href="https://i.stack.imgur.com/VK8vj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VK8vj.png" alt="enter image description here"></a></p>
  
  <p>Above is the image of what I want to achieve using String.xml</p>
  
  <p>There are three things</p>
  
  <ol>
  <li>'76' &amp; '20' will be replaced dynamically using String.format</li>
  <li>'20' should be bold</li>
  <li>'20' should be bigger in size</li>
  </ol>
  
  <p>I have tried all the solutions using Html.fromHtml class.</p>
  
  <p>Following are the solutions which I have tried. I am able to make '20' bold but couldn't make the '20' bigger in size.</p>
  
  <p>Following are the differet variations of String.xml which I have tried</p>
  
  <pre><code>&lt;string name="points_data"&gt;Use %1$d points= &amp;lt;font size="30"&gt;₹ %2$d&amp;lt;/font&gt; in payment&lt;/string&gt;
  
  &lt;string name="points_data"&gt;Use %1$d points= &lt;font size="14"&gt;&lt;b&gt;₹ %2$d&lt;/b&gt;&lt;/font&gt; in payment&lt;/string&gt;
  
  &lt;string name="points_data"&gt;Use %1$d points= &amp;lt;font size="14"&gt;&amp;lt;b&gt;₹ %2$d&amp;lt;/b&gt;&amp;lt;/font&gt; in payment&lt;/string&gt;
  
  &lt;string name="points_data"&gt;&lt;![CDATA[Use %1$d points= &lt;font size="60"&gt;&lt;b&gt;₹ %2$d&lt;/b&gt;&lt;/font&gt; in payment]]&gt;&lt;/string&gt;
  
  &lt;string name="points_data"&gt;Use %1$d points= &amp;lt;b&gt;&amp;lt;span style="fontSize='50'"&gt;₹ %2$d&amp;lt;/span&gt;&amp;lt;/b&gt; in payment&lt;/string&gt;
  </code></pre>
  
  <p>Following is the method I use for parsing above string</p>
  
  <pre><code>val formattedText = String.format(getString(R.string.points_data), 76, 20)
  
  textViewPoints.text = HtmlCompat.fromHtml(formattedText, HtmlCompat.FROM_HTML_MODE_LEGACY)
  </code></pre>
  
  <p>I have came across following links while googling for solution but none of them is working for my case. </p>
  
  <ol>
  <li><a href="https://developer.android.com/guide/topics/resources/string-resource" rel="nofollow noreferrer">https://developer.android.com/guide/topics/resources/string-resource</a></li>
  <li><a href="https://stackoverflow.com/questions/6200533/set-textview-style-bold-or-italic">Set TextView style (bold or italic)</a></li>
  <li><a href="https://stackoverflow.com/questions/37904739/html-fromhtml-deprecated-in-android-n">Html.fromHtml deprecated in Android N</a></li>
  </ol>
  
  <p>I have tried all the possible solutions which I could think of but none of them is working. I don't know what I am missing to implement. If anyone knows how to achieve this scenarion or knows about a way to achieve this please provide some guidance regarding that.</p>