-1
A
回答
0
这是我会怎么做,只是使用NotificationCompat.Builder。
// create RemoteViews
final RemoteViews remoteViews = new RemoteViews(getPackageName(), R.layout.remoteview_notification);
remoteViews.setImageViewResource(R.id.remoteview_notification_icon, R.mipmap.future_studio_launcher);
remoteViews.setTextViewText(R.id.remoteview_notification_headline, "Headline");
remoteViews.setTextViewText(R.id.remoteview_notification_short_message, "Short Message");
remoteViews.setTextColor(R.id.remoteview_notification_headline, getResources().getColor(android.R.color.black));
remoteViews.setTextColor(R.id.remoteview_notification_short_message, getResources().getColor(android.R.color.black));
// build notification
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(UsageExampleTargetsAndRemoteViews.this)
.setSmallIcon(R.mipmap.future_studio_launcher)
.setContentTitle("Content Title")
.setContentText("Content Text")
.setContent(remoteViews)
.setPriority(NotificationCompat.PRIORITY_MIN);
final Notification notification = mBuilder.build();
// set big content view for newer androids
if (android.os.Build.VERSION.SDK_INT >= 16) {
notification.bigContentView = remoteViews;
}
NotificationManager mNotificationManager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE);
mNotificationManager.notify(NOTIFICATION_ID, notification);
相关问题
- 1. 知道java是否已经过去了
- 2. 已经过了三个小时?
- 3. 自定义已经过时了
- 4. System.Net.Mail.SmtpClient在4.7中已经过时了吗?
- 5. 已经过了一个月了?
- 6. 自定义通知崩溃时使用setContent
- 7. 知道用户已经在django注册了多长时间
- 8. 如何知道进程已经运行了多长时间?
- 9. 通知角变量已经改变
- 10. 检查时区是否已经过了一定时间
- 11. c#中已经过去了吗?
- 12. 检查已经过了多少天
- 13. 如何检查是否已经通过自定义deltaTime函数通过了[Java]
- 14. 已经包含了
- 15. 它已经死了
- 16. 安装版本的Rubygems已经过时了,但我实际上已经安装了更新的版本?
- 17. 经常检查iframe是否已经通过jquery从内部更改了url
- 18. 通知打开时应用已经打开
- 19. 我如何知道时间是否已经过去? Swift
- 20. 确定自开始以来是否已经过了x`小时
- 21. 从JavaScript中的表格中计算时间已经过去了
- 22. Python中的`Builder`设计模式已经过时了吗?
- 23. 斯卡拉DAO模式已经过时了吗?
- 24. 我还需要多线程还是已经过时了?
- 25. 计算多少时间已经过去了
- 26. 检查的NodeJS如果XX的时代已经过去了
- 27. 我如何计算使用DateTime已经过了多少时间?
- 28. 在Rails中,map.resources现在已经过时了吗?
- 29. 阵营本地,PushNotification为iOS 10给出了 “UIUserNotificationSettings已经过时”
- 30. DataTable和DataSet应该现在已经过时了吗?