Notification.Builder nb = new Notification.Builder(context)
.setContentTitle("title")
.setContentText("content")
.setAutoCancel(true)
.setColor(ContextCompat.getColor(context, R.color.ANYCOLOR))
.setLargeIcon(largeIcon)
.setSmallIcon(small_icon)
.setTicker(s.getText());
NotificationManager nm = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
nm.notify(100, nb.build());
.setColor(getResources().getColor(R.color.yourcolor))
完整的代码如下:Notification.Builder nb = new Notification.Builder(context)
.setContentTitle("title")
.setContentText("content")
.setAutoCancel(true)
.setColor(getResources().getColor(R.color.primary))
.setLargeIcon(largeIcon)
.setSmallIcon(small_icon)
.setTicker(s.getText());
NotificationManager nm = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
nm.notify(100, nb.build());
setColor()
:http://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder.html#setColor%28int%29 - CommonsWare