开发者

is there any way to hyperlink text inside textview in android?

I am looking for hiperlink in single word in Textview.

txt.setText(Word1 + "\t" + Word2 + "\t" + word3);

Now I would like to add hyperlink in word2.

So is there anyway to set this text.

Th开发者_如何学Canks,


txt.setText(Html.fromHtml(Word1 + "<a href=\"your_link\">"+Word2+"</a>"));

To change the html in the onClickListener

I suggest you create your own class that extends TextView and add to it

String Word1;
String Word2;

In this way you can easily setText again and again without parsing the text

Anyway in the

onClickListener

Use again

setText


You can call any hyperlink with webview in onClickListner of a textview.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜