Autolink inside a TextView in android

前端 未结 5 1968
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-14 02:57

How to give autolink for some part of textview ? For example : My text inside TextView is \"Please click here to open this webpage\". I want to show link for only the text \

5条回答
  •  执笔经年
    2020-12-14 03:26

    Textviews are capable of displaying HTML, which solves your problem. Wrap what you want clickable in a hyperlink:

    String html = "My link is here";
    myTextView.setText(Html.fromHtml(html));
    

提交回复
热议问题