Skip to content Skip to sidebar Skip to footer

Using Html.fromhtml To Set Custom Typeface

I found this list of HTML-Tags that are (supposedly) supported for HTML.fromHtml to create a Spanned-Text: http://commonsware.com/blog/Android/2010/05/26/html-tags-supported-by-tex

Solution 1:

Simply use a <font> tag with a face attribute. This has been possible since at least Android 1.5 (see source code).

The value of the face attribute will be passed to the TypefaceSpan(String) constructor to create the Spannable. For example, use "monospace", "serif", or "sans-serif".

Solution 2:

Outdated. See other answers.


No, there's no way to do so. You can take a look at the Html implementation. As you will see, the font tag supports size and color only.

Post a Comment for "Using Html.fromhtml To Set Custom Typeface"