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

This entry was posted in Android Examples Code and tagged , . Bookmark the permalink.


Comments are closed.

7,396 views