android HTML 中实现列表效果以及html支持的标签

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 = 
  "&bull;	Cessnock<br />"
 +"&bull;	Dubbo<br />"
 +"&bull;	Goulburn<br />"
 +"&bull;	Grafton<br />"
 +"&bull;	Lithgow<br />"
 +"&bull;	Liverpool<br />"
 +"&bull;	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

posted on 2012-03-29 18:37  androidabc08  阅读(663)  评论(0编辑  收藏  举报