I want to put links on a TextView, i've put android:autoLink="web"
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/text_prix"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:autoLink="web"
android:padding="10dp"
android:t开发者_JAVA技巧extSize="16sp" >
</TextView>
and when i tap on the link i have the browser that it is opened correctly. But i want to dispaly on the textview a TAG for every link. How can i make this ? Example: For the link www.google.fr I want to jsut show on the ListView "Google". Is that possible? Thank you for your help.
You have to use Linkify ! http://developer.android.com/reference/android/text/util/Linkify.html
Or you can add Onclick action to your textview Example :
Textview text;
text = (Textview)findViewById(R.id.textview1);
text.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
}
});
精彩评论