In Android, HTML formatting is possible by using Html.fromHtml() in TextView.
TextView tv = (TextView)findViewById(R.id.text); tv.setText(Html.fromHtml("Text with <br><font color=\'#ff0000\'>Color</font> and <b>Bold</b>")); |
To use a string from a resource, the string have to be formatted this way:
[strings.xml]
<string name="html_string">Text with <br><font color=\'#898f97\'>Color</font> and <b>Bold</b></string> |
[TestActivity.java]
TextView tv = (TextView)findViewById(R.id.text); tv.setText(Html.fromHtml(getResources().getString(R.string.html_string))); |