开发者

Using Html.fromHtml to set custom Typeface

I found this list of HTML-Tags that are (supposedly) supported for HTML.fromHtml to create a Span开发者_Go百科ned-Text:

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

Now is there ANY way to set a custom Typeface with the Font-Tag?


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".


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜