来自带有链接结束文本的字符串的可点击链接
我需要制作带有网页链接的文本。我使用该代码但不起作用:
licence = (TextView)findViewById(R.id.about_text5);
final SpannableString s = new SpannableString(Html.fromHtml("The ipiit Team\n\nFYI: This software contains the <a href=\"http://code.google.com/p/zxing\">zxing</a> component licensed under <a href=\"http://httpd.apache.org/docs/2.0/license.html\">Apache 2.0</a>.\n\n"));
Linkify.addLinks(s, Linkify.WEB_URLS);
licence.setText(s);
licence.setMovementMethod(LinkMovementMethod.getInstance());
I need to make text with links to webpages. I use that code but is not working:
licence = (TextView)findViewById(R.id.about_text5);
final SpannableString s = new SpannableString(Html.fromHtml("The ipiit Team\n\nFYI: This software contains the <a href=\"http://code.google.com/p/zxing\">zxing</a> component licensed under <a href=\"http://httpd.apache.org/docs/2.0/license.html\">Apache 2.0</a>.\n\n"));
Linkify.addLinks(s, Linkify.WEB_URLS);
licence.setText(s);
licence.setMovementMethod(LinkMovementMethod.getInstance());
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为应该是...
而不是
因为您已经将 Spannable 文本设置为
TextView
,所以在TextView
上调用 addLinks...I think it should be...
and not
because you are already setting your Spannable text to your
TextView
, so call addLinks on theTextView
...