安卓:可点击的TextView与Linkified链接 [英] Android: Clickable TextView with Linkified links

查看:161
本文介绍了安卓:可点击的TextView与Linkified链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的布局一个TextView它在XML属性集点击=真。这是为了允许它表现得像文本和图标两者的按钮。
现在,我通过电话HTML.fromHtml()添加到TextView的HTML文本,之后申请Linkify.addLinks。

I have a TextView in my layout which has an attribute "clickable=true" set in XML. This is to allow it behave like a button with both text and icon. Now, I add to that TextView HTML text via call HTML.fromHtml(), and apply Linkify.addLinks after that.

问题是:在这样的配置,链接无法点击。是否有任何建议,如何让在链接用户点击,从创建自定义基于的TextView类等?

The problem is: in such configuration, links are not clickable. Is there any suggestion, how to allow user click on links, other from creating custom TextView-based class?

感谢

推荐答案

尝试添加属性机器人:自动链接=网络,到TextView的

try add an attribute "android:autoLink="web"" to the textview

这篇关于安卓:可点击的TextView与Linkified链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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