Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to apply font size while rendering HTML code in Android or Java

Tags:

java

android

My code is as follows.

textView.setText(Html.fromHtml("6<sup>4</sup>"));

The output is:

Enter image description here

Now I want to change the size of 4, so I applied the font as follows, but font is not getting applied.

textView.setText(Html.fromHtml("6<sup><font size="-2">4</font></sup>"));

How do I fix this problem?

like image 731
Android Killer Avatar asked Oct 12 '11 12:10

Android Killer


1 Answers

According to android.text.Html (on GrepCode), you may use <small> for smaller text, as <font> only supports color and face attributes.

like image 150
njzk2 Avatar answered Oct 16 '22 23:10

njzk2