Android 5.1 Notification设置问题

foreverfa06 2015-09-06 03:14:17
在android 5.1时候通过setSmallIcon(R.drawable.icon1)来设置了Notification在状态栏上显示的图片,可是程序在运行时,Notification显示的却是程序在application中定义的 android:icon="@drawable/ic_launcher",这个问题有人碰到过吗?
下面是我 Notification的代码:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification = new Notification.Builder(this)
//.setSmallIcon(R.drawable.animation1)
.setSmallIcon(R.drawable.icon1)
.setTicker("notification status bar")
.setContentTitle("notification title")
.setContentText("notification text")
.build();

nm.notify(0, notification);

}
...全文
145 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
peter_nj_RD 2015-11-16
  • 打赏
  • 举报
回复
跟各个手机的ROM有关,大部分的应用图标都是正方形的,通知图标就各种形状都有了,为了保持一致,最常用的方法就是使用应用图标替换显示
UESTC少尉 2015-11-16
  • 打赏
  • 举报
回复
碰到过,当时试了几个手机,有几个显示的就是小图标了,有几个显示的是程序图标,感觉与手机有关啊
djzhi3112 2015-09-06
  • 打赏
  • 举报
回复
静候佳音。。我也不会

80,349

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧