其中HTML标记的Andr​​oid TextView的支持? [英] Which HTML tags are supported by Android TextView?

查看:129
本文介绍了其中HTML标记的Andr​​oid TextView的支持?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Android的TextView的类可以通过HTML.fromHtml显示格式文本()按如下说明,例如:的 HTML标签的字符串的TextView

Android's TextView class can display formatted text via HTML.fromHtml() as explained for example here: HTML tags in string for TextView

TextView的类只能处理HTML的一小部分,但我不知道哪些标记和属性都支持的,哪些不是。这里给出的总结:<一href="http://commonsware.com/blog/Android/2010/05/26/html-tags-supported-by-textview.html">http://commonsware.com/blog/Android/2010/05/26/html-tags-supported-by-textview.html似乎不正确。例如。 &LT; D​​IV ALIGN =&QUOT; ...&QUOT;&GT;我使用的是不工作的Andr​​oid 2.2

The TextView class can only deal with a small subset of HTML, but I do not know which tags and attributes are supported and which are not. The summary given here: http://commonsware.com/blog/Android/2010/05/26/html-tags-supported-by-textview.html does not seem to be correct. E.g. <div align="..."> does NOT work for me using Android 2.2

推荐答案

我注意到这篇文章:

<一个href="http://daniel-$c$cs.blogspot.com/2011/04/html-in-textviews.html">http://daniel-$c$cs.blogspot.com/2011/04/html-in-textviews.html

列表&LT; D​​IV&GT;如通过Htm​​l.fromHtml()被支撑,但它并不显示为校准属性的支持。

lists <div> as being supported by Html.fromHtml(), but it doesn't show support for the "align" attribute.

(其它支持的属性显示为标签的页面上。)

(Other supported attributes are shown for tags on that page.)

笔者说,他通过在Git代码库望着code为Android构建的参考。

The author says he constructed the reference by looking at code in the git repositories for Android.

这篇关于其中HTML标记的Andr​​oid TextView的支持?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆