<?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"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:autoLink="email" android:text="[email protected]"/> <!--加入autoLink节点值为email,text节点值为[email protected]> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:autoLink="phone" android:text="10086"/> <!--定义TextView标签,加入autoLink节点值为phone,text值为10086--> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:autoLink="map" android:text="1812 Avenue K Plano,Texas 75074"/> <!-- 定义TextView标签,加入autoLink节点的值为text节点值为1812Avenue K Plano ,Texas 75074--> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:autoLink="all" android:text="18665373813"/> </LinearLayout>
autoLink不匹配任何类型的文字,默认为此选项
web匹配URL地址,单击后打开浏览器显示地址
email匹配邮箱地址,单击后打开发送邮件
phone匹配电话号码,单击后打开地图选项
all匹配所有的格式