背景:
阅读新闻

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

  作者: 今日评论: [字体: ]

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>

来源:
录入日期:[2011/07/12 0:41:00]
收藏 推荐 打印 | 录入:mikebai | 阅读:
文章评论      
正在加载评论列表...
评论关闭