首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
社区首页 >问答首页 >通知图标在Nougat中显示为正方形

通知图标在Nougat中显示为正方形
EN

Stack Overflow用户
提问于 2017-09-11 07:27:39
回答 1查看 929关注 0票数 0

你好,我已经在我的应用程序中实现了推送通知。它工作正常,并正确地显示通知图标以下的设备的牛油果版本。

但是,它将通知图标显示为白色正方形。

下面是我的代码:

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
            NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
                    .setSmallIcon(R.mipmap.app_icon)
                    .setColor(ContextCompat.getColor(getApplicationContext(),R.color.white))
                    .setContentTitle(strTitle)
                    .setContentText(messageBody)
                    .setAutoCancel(true)
                    .setSound(defaultSoundUri)
                    .setContentIntent(pendingIntent);

            NotificationManager notificationManager =
                    (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

            notificationManager.notify(++NOTIFICATION_ID /* ID of notification */, notificationBuilder.build());
EN

回答 1

Stack Overflow用户

发布于 2017-09-11 07:31:24

首先,这不是一个错误。这是Android Nougat在设计上的一个变化

对于Android Nougat,你应该提供圆角图标来通知。有关更多详细信息,请查看 this 链接和this

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46150324

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档
查看详情【社区公告】 技术创作特训营有奖征文