Thanks you for all of your answers.Now I find my question's answer.There are two steps.
1.you need set Textview property. android:autoLink="web"
<TextView
android:id="@+id/text_view"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:autoLink="web"
android:text="Lucy is very nice.Here is her link.https://www.google.com" />
2.override URL onclick.There is an example.
public class MainActivity extends Activity {
TextView tv;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
tv = (TextView) findViewById(R.id.tv);
CharSequence text = tv.getText();
if (text instanceof Spannable) {
int end = text.length();
Spannable sp = (Spannable) text;
URLSpan urls[] = sp.getSpans(0, end, URLSpan.class);
SpannableStringBuilder style = new SpannableStringBuilder(text);
style.clearSpans();
for (URLSpan urlSpan : urls) {
MyURLSpan myURLSpan = new MyURLSpan(urlSpan.getURL());
style.setSpan(myURLSpan, sp.getSpanStart(urlSpan),
sp.getSpanEnd(urlSpan),
Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
}
tv.setText(style);
}
}
private class MyURLSpan extends ClickableSpan {
private String url;
public MyURLSpan(String url) {
this.url = url;
}
@Override
public void onClick(View arg0) {
Toast.makeText(MainActivity.this, url, Toast.LENGTH_LONG).show();
}
}
}
3.The above code perfectly solved my problem.So when I click www.google.com in the Textview,the url will show out and jump to a specific activity.