Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding a web link to a TextView widget

I would like to know if and how it is possible to add a web link to a TextView widget. In my app, i show some text and adjacent to this text an image. I would like to insert a clickable internet link in the text. Is this possible?

like image 417
Marco Masci Avatar asked Jan 24 '12 18:01

Marco Masci


People also ask

Can I make a TextView clickable?

In Android, the most common way to show a text is by TextView element. The whole text in the TextView is easy to make clickable implementing the onClick attribute or by setting an onClickListener to the TextView.

How do I make a hyperlink?

Create a hyperlink to a location on the webSelect the text or picture that you want to display as a hyperlink. Press Ctrl+K. You can also right-click the text or picture and click Link on the shortcut menu. In the Insert Hyperlink box, type or paste your link in the Address box.


1 Answers

You just need to set the android:autolink property.

<TextView
        android:autoLink="web"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"        
        android:text="http://www.google.com" />
like image 106
The Real Baumann Avatar answered Oct 02 '22 18:10

The Real Baumann