如何在Lollipop中设置通知图标?

时间:2015-07-03 07:59:00

标签: android notifications icons android-5.0-lollipop

我无法在通知栏中找到app_icon 我想在通知图标中设置我的应用图标 我怎么能这样做?

NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context)             .setSmallIcon(图标);

我得到了应用程序图标的白色图标

1 个答案:

答案 0 :(得分:1)

我有同样的问题,主要是因为没有支持尺寸的问题。希望这可能有所帮助。

Notification noti = new NotificationCompat.Builder(context)
                .setContentTitle("DPD News")
                .setSmallIcon(R.drawable.YOURICON_SMALL) // this is the icon that show in notification are before drage down, small icon. this has to be 25px X 25px
                .setLargeIcon(LARGE_ICON) // i have use the same sizes of ic_launcher to this
                .setContentText("MESSAGE")
                .setContentIntent(pi)  // pending intent if needed
                .setAutoCancel(true)
                .build();