2、auto_link.xml文件
- <?xml version="1.0" encoding="utf-8"?>
- <LinearLayout xmlns:Android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical" >
- <TextView
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:autoLink="web"
- android:text="@string/webUrl" />
- <TextView
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:autoLink="email"
- android:text="@string/email" />
- <TextView
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:autoLink="phone"
- android:text="@string/phoneNumber" />
- <TextView
- android:id="@+id/tvHtml"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- />
- </LinearLayout>
这个文件简单的说明了超链接(auto_link)的使用方法,每种链接都有自己的格式,如果格式错误,不能链接
3、strings.xml文件
- <?xml version="1.0" encoding="utf-8"?>
- <resources>
- <string name="hello">Hello World, TextViewTestActivity!</string>
- <string name="app_name">TextViewTest</string>
- <string name="webUrl">凤凰网:http://www.ifeng.com</string>
- <string name="email">小强的邮箱:1234abc@163.com</string>
- <string name="phoneNumber">电话号码:1383838438</string>
- </resources>
模拟��显示效果:

