简体   繁体   English

如何在Android的状态栏通知中添加超链接

[英]How can I add an hyperlink in status bar notification in android

I have some html text in status bar notification and it is properly displaying in status bar text (with the formatting). 我在状态栏通知中有一些html文本,并且可以在状态栏文本中正确显示(带有格式)。 I also have a link in text that should open the url when clicked. 我也有一个文本链接,单击该链接应可打开URL。 how can I do this? 我怎样才能做到这一点?

the content of status bar notifiction is actually a resonse (html text) from some webservice. 状态栏通知的内容实际上是某些Web服务的响应(HTML文本)。

Android does not allow to do notifications without reaction on click. Android不允许在没有点击响应的情况下进行通知。 So you can do like this: 所以你可以这样:

Notification.contentIntent = PendingIntent.getActivity(context, 0, 
    new Intent(Intent.ACTION_VIEW, Uri.parse(YOUR_URL_HERE)),0);

I think it's not the best idea to do link only on text, because it's hard to click on i with finger. 我认为仅链接文本不是最好的主意,因为很难用手指点击我。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM