HTML Tags Supported By TextView
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>