2

请在下面找到具有存档和回复选项的 android gmail 通知屏幕。在按下回复而不是打开 gmail 应用程序时,edittext 应显示在通知区域中,该区域将接受回复文本消息,并且回复消息应从通知本身发送。我们怎样才能做到这一点?根据下面的链接,我们可以显示归档和回复按钮的设置操作。 http://developer.android.com/training/notify-user/expanded.html在此处输入图像描述

// Sets up the archive and reply action buttons that will appear in the
// big view of the notification.

Intent archiveIntent = new Intent(this, ResultActivity.class);
archiveIntent.setAction(CommonConstants.ACTION_ARCHIVE);
PendingIntent piArchive = PendingIntent.getService(this, 0, archiveIntent, 0);

Intent replyIntent = new Intent(this, ResultActivity.class);
replyIntent.setAction(CommonConstants.ACTION_REPLY);
PendingIntent piReply = PendingIntent.getService(this, 0, replyIntent, 0);


NotificationCompat.Builder builder = new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_stat_notification)
.setContentTitle(getString(R.string.notification)) .setContentText(getString(R.string.ping))
.setDefaults(Notification.DEFAULT_ALL) 
.setStyle(new NotificationCompat.BigTextStyle()
.bigText(msg))
.addAction (R.drawable.ic_stat_archive,getString(R.string.archive), piArchive)
.addAction (R.drawable.ic_stat_reply,getString(R.string.reply), piReply);

在按下回复按钮而不是转到 gmail 应用程序/打开整页 ResultActivity 时,它应该在通知区域本身显示指定高度、宽度和一个回复按钮的编辑文本。如何做到这一点?请建议可以遵循哪种方法来实现这一目标。提前致谢。

4

1 回答 1

0

目前这是不可能的。您有一组可能的通知类型,如下所示:http: //developer.android.com/guide/topics/ui/notifiers/notifications.html并且它们都不允许在通知抽屉中输入。您可以做的第二件事是让他们单击回复,然后可以打开一个仅包含必填字段的对话框(而不是打开整个活动)

于 2013-09-29T16:53:28.493 回答