技术开发 频道

Android TextView里字段如何获取超链接

  【IT168 技术】strings.xml文件内容如下:

  < resources>

  < string name="autolink_text">

  This is autolink text example.

  If you click on link http://www.google.com, then it will launch web browser.

  If you click on wzyang@gmail.com, then it will launch email program.

  And, if you click on phone number (626)888-6666,

  it should dial the phone automatically.< /string>

  < /resources>

  在main.xml文件内容如下:

  < LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

  android:orientation="vertical"

  android:layout_width="fill_parent"

  android:layout_height="fill_parent">

  < TextView

  android:id="@+id/text"

  android:layout_width="fill_parent"

  android:layout_height="fill_parent"

  android:autoLink="all"

  android:textSize="25sp"

  android:text="@string/autolink_text"/>

  < /LinearLayout>

0
相关文章