我怎样才能使一个EditText可点击的链接? [英] How can I make links in an EditText clickable?
本文介绍了我怎样才能使一个EditText可点击的链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个的EditText
Android上我最好的,我想任何嵌入的URL来点击。我使用了 Linkify
类,它已经把他们的蓝色,并强调他们。但是,我想不出如何真正让他们点击。
I have an EditText
on Android I'd for which I'd like any embedded urls to be clickable. I used the Linkify
class, which has turned them blue and underlined them. However, I can't figure out how to actually make them clickable.
谢谢!
推荐答案
XML:
android:linksClickable="true"
android:autoLink="web|email"
JAVA:
JAVA:
TextView textView = (TextView) findViewById(R.id.textViewId);
textView.setText(Html.fromHtml(html));
textView.setMovementMethod(LinkMovementMethod.getInstance());
这篇关于我怎样才能使一个EditText可点击的链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文