android TextView中的Linkify [英] Linkify in android TextView

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

问题描述

我有一个带有文本的文本视图"这是XYZ开发的产品.如需更多查询,请发送邮件至info@abc.com.我已链接info@abc.com".但问题是,无论何时我触摸文本视图下方的任何区域,它会链接到电子邮件.我如何确保,链接必须仅在单击 info@ 时才会发生....我使用了模式,Linkify.EMAIL_ADDRESS ...请提出一些答案

I have a text view with text" This is a product developed by XYZ. For more queries, mail us at info@abc.com. And I have linkified "info@abc.com". But the problem is, whenever I touch any area below the textview, it gets linked to the email. How Do I make sure, the link has to happen only on clicking info@....I used patterns, Linkify.EMAIL_ADDRESS..nothing seem to work...kindly suggest some answers

推荐答案

我在使用自动链接时遇到问题,所以我将其关闭,而是使用文本的 html 格式以及以下代码:

I had problems with automatic links, so I turned it off and instead I am using html formating of the text plus this code:

TextView textView = (TextView) findViewById(R.id.TextBox);
textView.setMovementMethod(LinkMovementMethod.getInstance());
textView.setText(Html.fromHtml(strText));

电子邮件链接 my@email.com</a>

这篇关于android TextView中的Linkify的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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