2010-09-20 80 views
0

例如下面的代码作品的权利TextUtil.concat不保留超链接

CharSequence text = TextUtils.concat("before ", Html.fromHtml("<b>This works</b>"), " after "); 
myTextView.setText(text, TextView.BufferType.SPANNABLE); 

如果我在HTML代码放在一个超链接,即

CharSequence text = TextUtils.concat("before ", Html.fromHtml("<a href=\"www.google.it\">Google</a>"), " after "); 
myTextView.setText(text, TextView.BufferType.SPANNABLE); 
Linkify.addLinks(myTextView, Linkify.ALL); 

“谷歌”被显示,但超链接不undelined正确并且不可点击。有什么建议?

回答

0

textsetText声明之间取出线Linkify.addLinks(myTextView, Linkify.ALL);并把下面一行:

classNameTextView.setMovementMethod(LinkMovementMethod.getInstance());

+0

曾为把classNameTextView.setMovementMethod(LinkMovementMethod.getInstance());之后的setText :)谢谢:) – rciovati 2010-09-22 18:43:14