[英]Icon not displaying in notification: white square shown instead and display it using mipmap launcher
// 3. Create and send a notification Notification notification = new NotificationCompat.Builder(this) .setSmallIcon(R.mipmap.ic_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);
}
}
} }
My question is when i run the app the app on device is supports the mipmap launcher but in loolipop and above devicesis not displaying the the white color and i want to display the same mipmap launcher in lolipop and above devices. 我的问题是,当我运行应用程序时,设备上的应用程序支持mipmap启动器,但在loolipop及更高版本的设备中无法显示白色,我想在lolipop及更高版本的设备中显示相同的mipmap启动器。 Thanks and help in advance!
谢谢并提前帮助!
You have to maintain appropriate sizes for different drawable folder. 您必须为不同的可绘制文件夹保持适当的大小。
Try these suggested sizes: 24 × 24 area in 32 × 32 (mdpi) 36 × 36 area in 48 × 48 (hdpi) 48 × 48 area in 64 × 64 (xhdpi) 72 × 72 area in 96 × 96 (xxhdpi) 96 × 96 area in 128 × 128 (xxxhdpi) 尝试以下建议的尺寸: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.