Android 通知图标问题
通知图标未出现在redmi设备中,它显示为默认ic_启动器,而在其他设备中显示图像。API 22和Android 5.1.1 minsdk=15,target=24。我已经在许多其他手机上测试过,没有问题,但在我的设备上,这个问题就存在了。你能解决这个问题吗。我的代码是Android 通知图标问题,android,performance,push-notification,notifications,android-notifications,Android,Performance,Push Notification,Notifications,Android Notifications,通知图标未出现在redmi设备中,它显示为默认ic_启动器,而在其他设备中显示图像。API 22和Android 5.1.1 minsdk=15,target=24。我已经在许多其他手机上测试过,没有问题,但在我的设备上,这个问题就存在了。你能解决这个问题吗。我的代码是 PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, 0); NotificationCompat.Builder builde
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, 0);
NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
builder.setSmallIcon(R.drawable.home1); //icon appears in device notification bar and right hand corner of notification
builder.setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.home1));
builder.setContentIntent(pendingIntent);
builder.setContentTitle(Title);
builder.setContentText(message);
builder.setSubText(subtext);
NotificationManager notificationManager = (NotificationManager) getSystemService(context.NOTIFICATION_SERVICE);
notificationManager.notify(NOTIFICATION_ID, builder.build());
提前感谢请在通知中使用两个图标。第一个是小的白色png,这样它会显示在状态栏中,第二个是应用程序徽标 更新下面文件夹中大小不同的白色图标
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
.setLargeIcon(
BitmapFactory.decodeResource(
getResources(), R.drawable.app_icon))
.setSmallIcon(R.drawable.app_logo_white_small)
.setContentTitle(mContext.getString(R.string.app_name))
.setDefaults(Notification.DEFAULT_ALL)
.setContentText(msg)
.setStyle(new NotificationCompat.BigTextStyle().bigText(msg))
.setContentIntent(getPendingIntent())
.setAutoCancel(true);
NotificationManager notificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify((int) System.currentTimeMillis(), notificationBuilder.build());
我希望它能帮助您。请在通知中使用两个图标。第一个是小的白色png,这样它会显示在状态栏中,第二个是应用程序徽标 更新下面文件夹中大小不同的白色图标
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
.setLargeIcon(
BitmapFactory.decodeResource(
getResources(), R.drawable.app_icon))
.setSmallIcon(R.drawable.app_logo_white_small)
.setContentTitle(mContext.getString(R.string.app_name))
.setDefaults(Notification.DEFAULT_ALL)
.setContentText(msg)
.setStyle(new NotificationCompat.BigTextStyle().bigText(msg))
.setContentIntent(getPendingIntent())
.setAutoCancel(true);
NotificationManager notificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify((int) System.currentTimeMillis(), notificationBuilder.build());
我希望它能对您有所帮助。您有不同版本的hdpi drawable home1吗,xhdpi等?是的,我有但仍然没有图像图标没有出现…请检查drawable home1的所有版本是否相似。是的,我再次检查,没有。png图像有不同的大小,如hdpi有20*20,其他有其他…您有不同版本的drawable home1用于hdpi,xhdpi等?是的,但仍然没有图像图标没有出现…请检查drawable home1的所有版本是否相似。是的,我再次检查,没有全部。png图像有不同的大小,如hdpi有20*20,其他有其他…仍然图像在我的设备中不工作,但它完全符合msg和allcan的要求。您也可以共享您的图标吗或者通知屏幕截图150%确定,因为它也出现在genymotion和其他设备中,除了redmi note 3sure,但如何因为我没有声誉来共享屏幕截图?默认ic_启动器将出现在我的设备中,直到图像在我的设备中不起作用,但它完全符合msg和ALL的要求。您是否也可以共享您的图标或通知屏幕shot150%确定,因为它出现在genymotion和其他设备上,除了redmi note 3sure,但怎么会因为我没有声誉来分享屏幕截图呢?默认的ic_启动器出现在我的设备上