如何在Android TextView中使深层链接字符串可点击 [英] How to make deep link string clickable in android TextView
本文介绍了如何在Android TextView中使深层链接字符串可点击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在Android TextView中使可点击的深层链接字符串例如 myapp:// product / 123。我知道有自动链接选项,例如电子邮件,网络和电话,但没有任何深层链接选项。如何使其可点击并启动该链接的点击意图?
How do I make a deep link string for example "myapp://product/123" clickable in android TextView. I know there are autoLink options like email, web and phone but there isn't any deeplink option. How do I make it clickable and launch the intent on click of that link?
推荐答案
您可以使用 ClickableSpan
例如。
ClickableSpan clickableSpan = new ClickableSpan() {
@Override
public void onClick(View textView) {
startActivity(new Intent(MyActivity.this, NextActivity.class));
}
@Override
public void updateDrawState(TextPaint ds) {
super.updateDrawState(ds);
ds.setUnderlineText(false);
}
};
查看此链接如何设置文本视图的一部分是可单击的
这篇关于如何在Android TextView中使深层链接字符串可点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文