1. 支持的标签:
- <a href="..."> 定义链接内容
-
定义粗体文字 b 是blod的缩写<b>
-
定义大字体的文字<big>
-
引用块标签<blockquote>
- 属性:
- Common -- 一般属性
- cite -- 被引用内容的URI
-
定义换行<br>
-
表示引用的URI<cite>
-
定义标签 dfn 是defining instance的缩写<dfn>
-
<div align="...">
-
强调标签 em 是emphasis的缩写<em>
-
<font size="..." color="..." face="...">
-
<h1>
-
<h2>
-
<h3>
-
<h4>
-
<h5>
-
<h6>
-
定义斜体文字<i>
-
<img src="...">
-
段落标签,里面可以加入文字,列表,表格等<p>
-
定义小字体的文字<small>
-
定义删除线样式的文字 不符合标准网页设计的理念,不赞成使用. strike是strikethrough的缩写<strike>
-
重点强调标签<strong>
-
下标标签 sub 是subscript的缩写<sub>
-
上标标签 sup 是superscript的缩写<sup>
-
定义monospaced字体的文字 不赞成使用. 此标签对中文没意义 tt是teletype or monospaced text style的意思<tt>
-
<u>
定义带有下划线的文字 u是underlined text style的意思
2. 使用方法:
tvHtml = (TextView) findViewById(R.id.tv_html);
String string = "textview使用html标签示例:"
+ "<br><b>字体加粗abcd</b><br>"
+ "<font color='red'>设置字体颜色abcd</font><br>"
+ "<font color='#0000ff'><big><i>定义大字体和斜体adcd</i></big></font><br>"
+ "段落标签<p>"
+ "<big><a href='http://www.baidu.com'>产生超链接-百度</a></big>";
CharSequence sequence = Html.fromHtml(string);
tvHtml.setText(sequence);</span>
tvHtml.setMovementMethod(LinkMovementMethod.getInstance());// 点击的时候产生超链接