如何添加一个按钮到通知? [英] How to add a button into notification?

查看:165
本文介绍了如何添加一个按钮到通知?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我这样做是这样的:

RemoteViews views = new RemoteViews(..);
views.setOnClickPendingIntent(R.id.button1,pd);
noti.contentviews = views;

然后通知通知。 我可以看到在通知中的按钮, 但按键不能点击。 当我按一下按钮,整个通知的点击! 我该如何解决这个问题? 我发现到处这一点,但没有什么有用的发现的。 有人说,一些手机不支持通知按钮,  而三星Galaxy S,在musicplayer的通知有按钮单击事件。

and then notify the notification. I can see the button in the notification, but the button can't be clicked. When i click the button,the whole notification clicked! How can i resolve this question? I found everywhere for this,but nothing useful found. someone said, some phones don't support the notification button, but samsung galaxy s, the musicplayer's notification has button click event.

推荐答案

您不能把互动的小部件,如按钮,在通知并从中获取用户输入。这些是只输出显示。

You cannot put interactive widgets, like a Button, in a Notification and get user input from them. These are for output display only.

这篇关于如何添加一个按钮到通知?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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