-1

我有一个 textview 显示电话:0900-1111,传真:0900-2222

有没有办法让手机可以点击,但传真不行。

使用

Phone: <a href="tel:09001111">0900-1111</a>, Fax: 0900-2222

将自动链接设置为电话,两者都是可点击的!

4

1 回答 1

4

你检查过 API 演示吗?

他们在 Views/Text/Linkify 下有一个示例。

该类位于 com.example.android.apis.text.Link.java

例如,其中一个 textView 使用的字符串是:

<string name="link_text_manual"><b>text2: Explicit links using &lt;a&gt; markup.</b>
  This has markup for a <a href="http://www.google.com">link</a> specified
  via an &lt;a&gt; tag.  Use a \"tel:\" URL
  to <a href="tel:4155551212">dial a phone number</a>.
</string>

和 textView 是:

  <TextView android:id="@+id/text2"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:paddingTop="8dp"
            android:paddingBottom="8dp"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:text="@string/link_text_manual"
            />
于 2013-02-07T23:33:32.753 回答