我有一个问题设定的Android 7.x的通知小图标黄色不能使用黄色与Android牛轧糖通知的小图标
我使用notification.setColor(Color.YELLOW);
同时建设的通知对象。它显示橄榄色(ish)而不是黄色。
还试图用notification.setColor(Color.argb(255,255,255,0));
但没有运气,它显示了同样的橄榄(ISH)的颜色。
这是怎么看起来像Android的7.x的
这是怎么看起来像Android的6.x中,这是正确的颜色
两张图片都使用相同的代码库显示相同的通知,但使用的是不同的Android设备。
我使用PushWoosh发送/接收推送通知,波纹管是我用来创建通知对象确切的代码。
public class NotificationFactory extends AbsNotificationFactory {
@Override
public Notification onGenerateNotification(PushData pushData) {
PushwooshUserdata pushwooshUserdata = GsonUtil.fromJson(pushData.getExtras().getString("u"), PushwooshUserdata.class);
//create notification builder
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(getContext());
notificationBuilder.setContentTitle("Header");
notificationBuilder.setContentText("Message");
//set small icon (usually app icon)
notificationBuilder.setSmallIcon(R.drawable.notification_icon);
notificationBuilder.setColor(Color.argb(255,255,255,0));
//set ticket text
notificationBuilder.setTicker(getContentFromHtml(pushData.getTicker()));
//display notification now
notificationBuilder.setWhen(System.currentTimeMillis());
//build the notification
final Notification notification = notificationBuilder.build();
//add sound
addSound(notification, pushData.getSound());
//add vibration
addVibration(notification, pushData.getVibration());
//make it cancelable
addCancel(notification);
//all done!
return notification;
}
@Override
public void onPushReceived(PushData pushData) {
}
@Override
public void onPushHandle(Activity activity) {
}
}
这可能是有益的描述多一点点关于你如何建立你的通知 – Chisko
谢谢@Chisko,我更新的问题,包括我使用的是确切的代码。 –