问题
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 !
回答1:
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 <a> markup.</b>
This has markup for a <a href="http://www.google.com">link</a> specified
via an <a> 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"
/>
来源:https://stackoverflow.com/questions/14762956/android-textview-with-clickable-phone-number