0

I have used

Linkify.addLinks(textview, Linkify.ALL);

To make a TextView clickable, and to act like, well, a link. The problem is, if the link is too large, it looks very ugly. Is there any way to make it shorter, or substitute the url for a text? Anybody knows of a library that can suit me?

Thank you.

Fustigador
  • 6,339
  • 12
  • 59
  • 115

1 Answers1

1

Try to use the following in the textView.setText() method:

Html.fromHtml("A text with a <a href=\"http://somelonglink\">link</a>")
Gabor Novak
  • 286
  • 1
  • 7
  • Getting out of job right now...will try it tomorrow, and will upvote if it works. – Fustigador Sep 15 '15 at 13:27
  • Unfortunately, not. The word link looks like a link, but does not answer to clicking. I tried to Linkify the textView, but didn't work. We have changed the layout, so now instead of textviews are buttons, so I don't need a way to shorten the url now. Thanks for trying, anyway. – Fustigador Sep 17 '15 at 11:47
  • Okay. BTW it should solve the problem if you call `textView.setMovementMethod(LinkMovementMethod.getInstance());` on your textView. – Gabor Novak Sep 17 '15 at 12:46