I have a textview showing Phone: 0900-1111, Fax: 0900-2222

Is there a way to make the phone clickable but not the fax.

Using

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

With autolink set to phone, both are clickable !

有帮助吗?

解决方案

have you checked the API demos ?

They have a sample just for this , under Views/Text/Linkify.

The class is located at com.example.android.apis.text.Link.java

for example , the string used there for one of the textView is :

<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>

and the textView is :

  <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"
            />
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top