Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android textview html font size tag

I use <font size ="50"> tag in android textview like this

resultTextView.setText(Html.fromHtml("<font size='50' color='#337744'>Text Message</font>")); resultTextView.setText(Html.fromHtml("<font size=\"50\" color='#337744'>Text Message</font>")); 

but the problem is the color tag works but size tag doesn't work

In this blog http://commonsware.com/blog/Android/2010/05/26/html-tags-supported-by-textview.html

it is given that font size tag works. What's wrong in my code?

like image 432
user2637015 Avatar asked Aug 18 '13 05:08

user2637015


People also ask

How do I change font size in HTML android?

You can use use <small> for smaller text and so on.

How do I change font size in XML?

Adding fonts to a TextView To set a font for the TextView , do one of the following: In the layout XML file, set the fontFamily attribute to the font file you want to access. Open the Properties window to set the font for the TextView .


1 Answers

There is exact question Using size HTML attribute in TextView . It says it ignores the size. You can use use <small> for smaller text and so on. <font> only supports color and face attributes. see android.text.Html (on GrepCode) and How to apply font size while rendering HTML code in Android or Java and TextView with different textSize for more. Hope it helps in someway.

like image 111
Shobhit Puri Avatar answered Oct 04 '22 18:10

Shobhit Puri