【发布时间】:2016-10-20 05:23:10
【问题描述】:
我正在尝试更改通知图标,在模拟器中可以:
这就是我想要的(在模拟器 API 级别 22(Android 5.1.1)上测试)但是,当我在我的真实手机(带有 MIUI 8.0.1 的小米红米 3 Prime)上运行这个应用程序时也是 android 5.1。 1 - 通知看起来非常非常不同。此通知图标不显示(只是一个默认应用程序图标)。
但是……为什么?我现在能做什么?
这是我的代码:
NotificationCompat.Builder b = new NotificationCompat.Builder(compat);
b.setSmallIcon((state == STATE_STOPPED) ? R.drawable.ic_stat_remove : R.drawable.check);
b.setContentText(content);
b.setContentTitle(BASE_NOTIFICATION_TITLE);
b.setOngoing(true);
b.setAutoCancel(true);
b.setColor((state == STATE_STOPPED) ? Color.RED : Color.rgb(22, 219, 28));
NotificationManager m = (NotificationManager) compat.getSystemService(NOTIFICATION_SERVICE);
m.notify(0, b.build());
只是一个非常简单的通知...有人可以告诉我,有什么问题吗?或者只是 MIUI 关闭所有通知图标并将其设置为默认应用启动图标?
谢谢!
编辑:我手机中的通知看起来像这样......
【问题讨论】:
标签: java android notifications