【发布时间】:2015-12-11 14:26:25
【问题描述】:
如图...
我收到通知图标(在红色左侧)。
但我需要显示应用程序图标,如黑色箭头所示
public void notify(View view){
notification.setSmallIcon(R.drawable.ic_stat_name);
notification.setTicker("Welcome to ****");
notification.setWhen(System.currentTimeMillis());
notification.setContentTitle("abcd");
notification.setContentText("abcd");
Intent intent = new Intent(this, home.class);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
notification.setContentIntent(pendingIntent);
NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
nm.notify(uniqueID, notification.build());
}
【问题讨论】:
-
在通知生成器中使用 .setSmallIcon(R.drawable.ic_launcher)
-
我已经发布了我的代码
-
@Sathish 不正确。 ic_launcher 不是可绘制的。使用
setSmallIcon(R.mipmap.ic_launcher)
标签: android android-studio notifications android-notifications android-notification-bar