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-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".
this has worked for me
Typeface typeface = Typeface.createFromAsset(context.getAssets(), "fonts/OpenSans-Regular.ttf");
currentRounds.setTypeface(typeface);
currentRounds.setText(Html.fromHtml("Current Rounds <br><b>2650</b>"));
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.