http://android.okhelp.cz/html-list-tag-in-android-textview-android-sample/
Html List tag in Android TextView – Android sample
Html.fromHtml(String) does not support all HTML tags. For example < ul > and < li > are not supported.
Try this source code as a substitute for HTML List Tags.
String str =
"• Cessnock<br />"
+"• Dubbo<br />"
+"• Goulburn<br />"
+"• Grafton<br />"
+"• Lithgow<br />"
+"• Liverpool<br />"
+"• Newcastle<br />"
;
textview.setText(Html.fromHtml(str));
Result:
• Cessnock
• Dubbo
• Goulburn
• Grafton
• Lithgow
• Liverpool
• Newcastle
Supported tags
<a href="www.bla.com">bla.com</a>
<b></b>
<big></big>
<blockquote></blockquote>
<br />
<cite></cite>
<dfn></dfn>
<div></div>
<em></em>
<font></font>
<h1></h1>
<h6></h6>
<i></i>
<img src="bla.jpg" border="0">
<p></p>
<small></small>
<strong></strong>
<sub></sub>
<sup></sup>
<tt></tt>
<u></u>
a
b
big
blockquote
br
cite
dfn
div
em
font
h1-h6
i
img
p
small
strong
sub
sup
tt
u
本文介绍了在Android应用中如何处理HTML文本,特别是在TextView中显示带有特定HTML标签的内容。由于Android系统内置的Html.fromHtml方法不支持所有HTML标签,如<ul>和<li>,文章提供了一段替代源代码来解决这一问题,使得开发者能够更灵活地在应用中展示HTML格式的列表。同时,文章列出了TextView支持的一系列HTML标签。
767

被折叠的 条评论
为什么被折叠?



