Android的TextView中与点击电话号码 [英] Android textview with clickable phone number
本文介绍了Android的TextView中与点击电话号码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个TextView表现
电话:0900-1111,传真:0900-2222
I have a textview showing Phone: 0900-1111, Fax: 0900-2222
有没有一种方法,使手机点击,但不是传真。
Is there a way to make the phone clickable but not the fax.
使用
电话:< A HREF =电话:09001111> 0900-1111< / A>中传真:0900-2222
使用自动链接设置为手机,无论是可以点击的!
With autolink set to phone, both are clickable !
推荐答案
你检查的API演示?
have you checked the API demos ?
他们只为这一个样本,在查看/文字/ Linkify。
They have a sample just for this , under Views/Text/Linkify.
类位于com.example.android.apis.text.Link.java
The class is located at com.example.android.apis.text.Link.java
例如,使用那里的TextView中的一个字符串是:
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>
和TextView的是:
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"
/>
这篇关于Android的TextView中与点击电话号码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文