通知图标图像不会改变(android)

时间:2017-04-10 11:30:03

标签: java android android-notifications

这是我的代码:

Bitmap largeIcon = BitmapFactory.decodeResource(getResources(), R.drawable.ic_test_1);

        NotificationCompat.Builder mBuilder =
                new NotificationCompat.Builder(this)
                        .setSmallIcon(R.drawable.ic_test_1)
                        .setContentTitle("My notification")
                        .setContentText("Sssssssssssssssssssss")
                        .setLargeIcon(largeIcon);

但它不会改变图像,它只是作为启动器图标保留,有什么问题吗?

1 个答案:

答案 0 :(得分:0)

1 - 创建尺寸为128 * 128的照片。

2 - 使用以下代码替换代码:

 NotificationCompat.Builder mBuilder =
            new NotificationCompat.Builder(this)
Bitmap largeIcon = BitmapFactory.decodeResource(getResources(), R.drawable.Your photo with a size of 128 x 128);
                    .setSmallIcon(R.drawable.ic_test_1)
                    .setContentTitle("My notification")
                    .setContentText("Sssssssssssssssssssss")
                    .setLargeIcon(largeIcon);