加载方式
TextView
String textHtml = "<p>aaa</p><p><strong>fafjoa</strong></p><p style=\"text-align: center;\"><span style=\"color: rgb(227, 0, 0);\"><strong>bbb</strong></span></p>";
String imgHtml = "<img src="http://xxxx.png" />"
textView1.setText(Html.fromHtml(textHtml ));
textView2.setText(Html.fromHtml(imgHtml ));
结果
1、span标签无法显示,即字体颜色没加载出来,查看Html.java 源码,可见支持的标签是有限的
2、图片img标签也没有加载出来
private void handleStartTag(String tag, Attributes attributes) {
if (tag.equalsIgnoreCase("br")) {
// We don't need to handle this. TagSoup will ensure that there's a </br> for each <br>
// so we can safely emit the linebreaks when we handle the close tag.