[英]Icon not displaying in notification: white square shown instead and display it using mipmap launcher
// 3.创建并发送通知Notification notification = new NotificationCompat.Builder(this).setSmallIcon(R.mipmap.ic_launcher)
.setContentTitle("Geofence Monitor")
.setContentText(text)
.setContentIntent(pendingNotificationIntent)
.setStyle(new NotificationCompat.BigTextStyle().bigText(bigText))
.setPriority(NotificationCompat.PRIORITY_HIGH)
.setAutoCancel(true)
.build();
notificationManager.notify(0, notification);
if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
new NotificationCompat.Builder(this).setSmallIcon(R.mipmap.ic_launcher);
} else {
new NotificationCompat.Builder(this) .setSmallIcon(R.mipmap.ic_launcher);
}
}
}
我的问题是,当我运行应用程序时,设备上的应用程序支持mipmap启动器,但在loolipop及更高版本的设备中无法显示白色,我想在lolipop及更高版本的设备中显示相同的mipmap启动器。 谢谢并提前帮助!
您必须为不同的可绘制文件夹保持适当的大小。
尝试以下建议的尺寸:32×32(mdpi)的24×24区域48×48(hdpi)的36×36区域64×64(xhdpi)的48×48区域96×96(xxhdpi)的72×72区域96 ×128×128(xxxhdpi)的×96区域
并尝试在此处遵循这些准则
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.