在Android中(在JB),我怎么可以添加一个动作到自定义丰富的通知?自定义、丰富、我怎么、通知

2023-09-07 23:59:33 作者:沧海桑田的拥有

我一直在玩Jelly Bean中的新富notificaitons,并一切正常,当我成立了一个新的notificaiton使用模板预期 Notification.BigPictureStyle Notification.BigTextStyle Notification.InboxStyle 。我可以使用 Notification.Builder.addAction()方法和操作按钮在扩展的通知的底部出现。但是,当我尝试创建使用cutsom通知Notification.bigContentView,操作按钮从未露面。

I've been playing with the new rich notificaitons in Jelly Bean, and everything works as expected when I set up a new notificaiton using the templates Notification.BigPictureStyle, Notification.BigTextStyle, or Notification.InboxStyle. I can use the Notification.Builder.addAction() method, and the action buttons show up at the bottom of the extended notification. But when I try to create a cutsom notification using Notification.bigContentView, the action buttons never show up.

我想弄清楚,如果我从来没有设置 bigContentView 的按钮显示出来。但是,一旦该字段设置为自定义RemoteViews对象,按钮都不见了。

Just to clarify, if I never set bigContentView, the buttons do show up. But as soon as that field is set to a custom RemoteViews object, the buttons are gone.

有没有人对为什么发生这种情况的任何想法?

Does anyone have any ideas on why this is happening?

推荐答案

各种大...样式制造商创建自己的 bigContentView 。如果你想让自己的 bigContentView ,你必须将自己添加的按钮,或者通过检查来源$ C ​​$ C到这些建设者,看他们是如何做到这一点。

The various Big...Style builders create their own bigContentView. If you want your own bigContentView, you have to add the buttons yourself, perhaps by examining the source code to those builders and seeing how they do it.