Make a hyperlink textview in android

后端 未结 6 1939
太阳男子
太阳男子 2020-11-28 07:34

I want to make a link for a textview text like Google. Is there anyway to make link like this. (i.e) When clicking on the word Google it should open the appropriate link. An

6条回答
  •  难免孤独
    2020-11-28 07:51

    For Latest version of SDK fromHtml is deprecated Use below line

    String yourtext = " Sample Website ";
        if (Build.VERSION.SDK_INT >= 24) {
            textView.setText(Html.fromHtml(yourtext, Html.FROM_HTML_MODE_LEGACY));
        } else {
            textView.setText(Html.fromHtml(yourtext));
        }
    

提交回复
热议问题