我想要文本视图作为可点击的链接 [英] I want text view as a clickable link

查看:22
本文介绍了我想要文本视图作为可点击的链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<TextView
    android:id="@+id/link"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true"
    android:text="Forget password?"
    android:autoLink="all"
    android:linksClickable="true"
    android:textColor="@color/lgreen"
    android:textStyle="italic"
     />

Android 正在突出显示 TextView 中的链接,但它们不响应点击.有人可以告诉我如何将其作为可点击并移动到另一个链接.我通过查看示例尝试了更多次.但我不能.有人可以向我解释清楚如何将文本视图更改为可点击链接.

Android is highlighting the links in the TextView, but they do not respond to clicks. Can someone tell me how can i do that as a clickable and move to another link. i tried more times by seeing examples. but i can't. Can some one explain me clearly how to change text view as a clickable link.

推荐答案

所有测试和工作 100%
下面是一个完整的例子
解决方法:android:autoLink="web"
示例 XML:

All tested and working 100%
below is a complete example
Solution: android:autoLink="web"
Sample Xml:

<TextView
    android:id="@+id/txtLostpassword"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:autoLink="email"
    android:gravity="center"
    android:padding="20px"
    android:text="@string/lostpassword"
    android:textAppearance="?android:attr/textAppearanceSmall" />

<TextView
    android:id="@+id/txtLostpassword"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:autoLink="web"
    android:gravity="center"
    android:padding="20px"
    android:text="@string/defaultpassword"
    android:textAppearance="?android:attr/textAppearanceSmall" />

string.xml

<string name="lostpassword">If you lost your password please contact <a href="mailto:support@cleverfinger.com.au?Subject=Lost%20Password" target="_top">support@cleverfinger.com.au</a></string>

<string name="defaultpassword">User Guide <a href="http://www.cleverfinger.com.au/user-guide/">http://www.cleverfinger.com.au/user-guide/</a></string>

这篇关于我想要文本视图作为可点击的链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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