Ahm*_*sef 5 notifications android google-cloud-messaging
我在Android 7.x中将通知小图标设置为黄色时遇到问题
我正在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) {
}
}
Run Code Online (Sandbox Code Playgroud)
小智 8
Android正在确保前景色和背景色之间的最小对比度.
使用黄色(#ffff35)前景和白色背景,对比度仅为1.07:1.
橄榄色前景(#717d13)的最小对比度为4.5:1.
这是Android源代码中的相关补丁:https://android.googlesource.com/platform/frameworks/base.git/+/4ff3b120ff8a788e3afeb266d18caf072f0b8ffb%5E%21/
我使用http://webaim.org/resources/contrastchecker/计算了上述对比度.
| 归档时间: |
|
| 查看次数: |
747 次 |
| 最近记录: |