安卓:可点击的TextView与Linkified链接链接、TextView、Linkified

2023-09-07 09:27:00 作者:情癌晚期

我在我的布局一个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

 
精彩推荐