如何使机器人可点击锚标记 [英] how to make anchor tag in android clickable
本文介绍了如何使机器人可点击锚标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的code:
TextView aboutL1 = (TextView) findViewById(R.id.aboutL2);
aboutL1.setText(Html.fromHtml("This app is open source.<br>The source code is hosted on <a href=\"http://herp.com/derp\">Github</a> "));
Linkify.addLinks(aboutL1, Linkify.ALL);
字github上显示为一个链接,但没有任何反应,当我点击链接...
The word github appears as a link but nothing happens when I click on the link ...
推荐答案
您需要调用<一个href="http://developer.android.com/reference/android/widget/TextView.html#setMovementMethod%28android.text.method.MovementMethod%29"相对=nofollow> setMovementMethod :
aboutL1.setMovementMethod(LinkMovementMethod.getInstance());
(你甚至可能不会需要调用 Linkify.addLinks
,因为你使用 Html.fromHtml
,但我可以'T完全记不清了)。
(you may not even need to call Linkify.addLinks
since you used Html.fromHtml
, but I can't totally remember).
这篇关于如何使机器人可点击锚标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文