How can I make links in fromHTML clickable? (Android)

后端 未结 5 1292
温柔的废话
温柔的废话 2020-12-04 16:08

This seems like a trivial problem, but is has me kind of stumped. I want to load an HTML string using Html.fromHtml(), and have any links in the string to be clickable and o

5条回答
  •  天涯浪人
    2020-12-04 17:09

    It should be this way:

    textView.setText(Html.fromHtml("This is a link"));
    textView.setAutoLinkMask(Linkify.WEB_URLS);
    textView.setLinksClickable(true);
    

    in XML should be

    
    

提交回复
热议问题