如何在文本视图Android中显示此HTML文本

时间:2015-06-06 10:12:25

标签: android

我有这个HTML字符串

“列表\ u003ca href = \”http://www.indiacom.com/ \“\ u003eIndiacom Yellow Pages \ u003c / a \ u003e”

如何在文字视图中显示此内容?

Html.fromhtml()不是wrking。

2 个答案:

答案 0 :(得分:0)

尝试以下代码

String value = "<html> <a href=\"http://example.com/\">example.com</a> </html>";
tv= (TextView) findViewById(R.id.textViewSite);
tv.setText(Html.fromHtml(value));
tv.setMovementMethod(LinkMovementMethod.getInstance());

答案 1 :(得分:0)

添加以下代码以在您的应用中显示Html字符串:

tv1.setText(Html.fromHtml("<a href=\""http://www.indiacom.com/"\">" Indiacom Yellow Pages "</a>"));
tv1.setClickable(true);
tv1.setMovementMethod (LinkMovementMethod.getInstance());