pRa*_*NaY 5 android android-edittext linkmovementmethod
I am working with EditText which take WebUrl in input.For that I am using LinkMovementMethod Make links in the EditText clickable.
Problem is that :
If the last part of the text is a link, clicking anywhere causes the link to be opened.
I want when I am clicking on click here to edit area edittext, It will be editable?
Daniel Lew 几天前写了一篇关于它的博客文章。他建议下一个解决方案:
// 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);
Run Code Online (Sandbox Code Playgroud)
您可以在这里找到帖子:制作带有可点击和可编辑链接的 EditTexts
| 归档时间: |
|
| 查看次数: |
381 次 |
| 最近记录: |