自动链接里面一个TextView android系统 [英] Autolink inside a TextView in android

查看:252
本文介绍了自动链接里面一个TextView android系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何让自动链接的TextView中的某些部分?例如:我的内部的TextView文本是请点击此处打开此网页。我想说明的链接仅文本在这里。我应该打开文本在这里,而不是在TextView中的任何地方该网页的onclick。请帮我。

How to give autolink for some part of textview ? For example : My text inside TextView is "Please click here to open this webpage". I want to show link for only the text "here". And I should open that webpage onclick of the text "here" but not on the anywhere of TextView. Please help me.

推荐答案

将一个字符串中string.xml

Put a String in string.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="txtCredits">Support: <a href="http://www.stackoverflow.com">click here</a></string>
</resources>

和您可以使用它在TextView中是这样的:

And you can use it in textView like this:

<TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:autoLink="web"
        android:gravity="center"
        android:linksClickable="true"
        android:text="@string/txtCredits" />

这篇关于自动链接里面一个TextView android系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆