2011-09-26 32 views

回答

15

簡單。只要把鏈接放在你的TextView中。

<TextView 
    android:id="@+id/txtLink" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="@string/about_link" 
    android:autoLink="all" /> 

注意:這裏最重要的屬性是android:autoLink="all"。這使您可以鏈接到網址,電子郵件和電話號碼。

在strings.xml添加鏈接:

<string name="about_link"><a href='http://example.com'>http://example.com</a></string> 
<string name="about_email"><a href='mailto:[email protected]'>[email protected]</a></string> 

我知道這個答案是真的來晚了,但希望它可以幫助別人磨磨蹭蹭。

3
Uri uri = Uri.parse("http://www.example.com"); 
Intent intent = new Intent(Intent.ACTION_VIEW, uri); 
startActivity(intent); 
+0

與所提問題甚至不盡相同 –

相關問題