How can I make links in an EditText clickable?

前端 未结 4 877
暗喜
暗喜 2021-02-01 07:21

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 unde

4条回答
  •  野的像风
    2021-02-01 08:06

    XML:

     android:linksClickable="true"
     android:autoLink="web|email"
    

    JAVA:

    TextView textView = (TextView) findViewById(R.id.textViewId);
    textView.setText(Html.fromHtml(html));
    textView.setMovementMethod(LinkMovementMethod.getInstance());
    

提交回复
热议问题