Android textview with clickable phone number [closed]

喜欢而已 提交于 2019-12-04 22:07:00

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"
            />
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!