本文介绍了带有可点击和可编辑链接的EditText的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用将WebUrl作为输入的EditText.为此,我正在使用 LinkMovementMethod
使EditText中的链接可单击.
I am working with EditText which take WebUrl in input.For that I am using LinkMovementMethod
Make links in the EditText clickable.
问题在于:
我要在单击单击此处进行编辑区域的编辑文本时,该文本是否可编辑?
I want when I am clicking on click here to edit area edittext, It will be editable?
推荐答案
Daniel Lew几天前写了关于它的博客文章.他建议下一个解决方案:
Daniel Lew wrote the blog post about it several days ago. He suggests next solution:
// Make links in the EditText clickable
editText.setMovementMethod(LinkMovementMethod.getInstance());
// Setup my Spannable with clickable URLs
Spannable spannable = new SpannableString("http://blog.danlew.net");
Linkify.addLinks(spannable, Linkify.WEB_URLS);
// The fix: Append a zero-width space to the Spannable
CharSequence text = TextUtils.concat(spannable, "\u200B");
// Use it!
editText.setText(text);
您可以在此处找到帖子:使EditText包含可点击和可编辑的链接
You can find post here: Making EditTexts with links both clickable and editable
这篇关于带有可点击和可编辑链接的EditText的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!