在Android中(在JB),我怎么可以添加一个动作到自定义丰富的通知? [英] In Android (on JB), how can I add an action to a custom rich notification?

查看:117
本文介绍了在Android中(在JB),我怎么可以添加一个动作到自定义丰富的通知?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在玩Jelly Bean中的新富notificaitons,并一切正常,当我成立了一个新的notificaiton使用模板预期 Notification.BigPictureStyle Notification.BigTextStyle Notification.InboxStyle 。我可以使用 Notification.Builder.addAction()方法和操作按钮在扩展的通知的底部出现。但是,当我尝试创建使用cutsom通知<一个href=\"http://developer.android.com/reference/android/app/Notification.html#bigContentView\">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 ,你必须将自己添加的按钮,或者通过检查<一href=\"https://github.com/android/platform_frameworks_base/blob/master/core/java/android/app/Notification.java\"相对=nofollow>来源$ 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.

这篇关于在Android中(在JB),我怎么可以添加一个动作到自定义丰富的通知?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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