html.fromhtml突出显示链接不起作用

时间:2013-11-25 01:06:34

标签: android

我在Textview中有一个链接,当我点击它时工作(打开链接),但在打开之前不要突出显示链接的颜色。

这是我的代码:

text.setText(Html.fromHtml("<a href='http://google.com'>Google</a> example of link");

2 个答案:

答案 0 :(得分:0)

这应该有用。

textView.setText(Html.fromHtml("<a href=\"http://www.google.com\">This is a link</a>"));
textView.setMovementMethod(LinkMovementMethod.getInstance());

来自Gunnar的解决方案。

答案 1 :(得分:0)

添加此行以使其正常工作 -

htmlContent.setMovementMethod(LinkMovementMethod.getInstance());
相关问题