use*_*195 17 notifications icons android material-design
我尝试将小图标精确地制作成16x16,灰度,灰色和白色(灰色为hex616161),以创建应用程序图标的轮廓.
然而,无论它在通知中显示为白色/灰色方块.我究竟做错了什么?
(我的分数api是21,假设它是相关的)
nhp*_*nhp 36
点击此链接
首先让我们了解Android文档,如下所示
"更新或删除涉及颜色的资产.系统会忽略操作图标和主通知图标中的所有非Alpha通道.您应该假设这些图标仅为alpha.系统以白色绘制通知图标,以深灰色绘制动作图标."
现在这很容易错过,我已经看到很多应用程序存在于应用程序商店中,有数千名用户没有遵循上述指南.
因此,让我详细解释如何通过几次点击将您的通知图标转换为Android友好图标.
在您喜欢的图像编辑器中打开您的图标文件.将您不想显示的图像的所有部分转换为透明像素.所有颜色和非透明像素均以白色显示.我们来看一个例子.
您可以询问设计师或使用此工具生成您的图标
对于通知,您必须对不同版本的android使用不同的图标:
Notification notification = new Notification.Builder(context)
.setAutoCancel(true)
.setContentTitle("My notification")
.setContentText("Look, white in Lollipop, else color!")
.setSmallIcon(getNotificationIcon())
.build();
return notification;
Run Code Online (Sandbox Code Playgroud)
根据版本获取通知图标
private int getNotificationIcon() {
boolean useWhiteIcon = (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP);
return useWhiteIcon ? R.drawable.icon_silhouette : R.drawable.ic_launcher;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
15622 次 |
| 最近记录: |