mikebai.com

  • Home
  • dev
  • DotNET
  • M365
  • 搞笑
  • 杂七杂八
  • FocusDict
個人BLOG
it developer
  1. Main page
  2. dev
  3. Main content

Android TextView 支持的HTML标签【转载】

2011-07-12 109hotness 0likes 0comments

There is a lovely method on the android.text.Html class, fromHtml(), that converts HTML into a Spannable for use with a TextView.


However, the documentation does not stipulate what HTML tags are supported, which makes this method a bit hit-or-miss. More importantly, it means that you cannot rely on what it will support from release to release.


I have filed an issue requesting that Google formally document what it intends to support. In the interim, from a quick look at the source code, here’s what seems to be supported as of Android 2.1:


    * <a href="...">
    * <b>
    * <big>
    * <blockquote>
    * <br>
    * <cite>
    * <dfn>
    * <div align="...">
    * <em>
    * <font size="..." color="..." face="...">
    * <h1>
    * <h2>
    * <h3>
    * <h4>
    * <h5>
    * <h6>
    * <i>
    * <img src="...">
    * <p>
    * <small>
    * <strike>
    * <strong>
    * <sub>
    * <sup>
    * <tt>
    * <u>

Tag: Nothing
Last updated:2011-07-12

mikebai

This person is a lazy dog and has left nothing

Like
< Last article
Next article >

COPYRIGHT © 2025 mikebai.com. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang