【发布时间】:2012-06-13 22:58:16
【问题描述】:
我的应用程序中的通知栏仅显示代码中的小图标(应该如此)。但是,当“阴影”被拉下时,它会同时显示代码中的小图标,以及我在 Notification.Builder 中设置的大图标。这是我的代码:
if (Build.VERSION.SDK_INT > 10){
notification = new Notification(R.drawable.ic_stat_mintchip,
"This is a test",
System.currentTimeMillis());
notification.largeIcon = (((BitmapDrawable)c.getResources().getDrawable(R.drawable.ic_launcher)).getBitmap());
notification.defaults |= Notification.DEFAULT_ALL;
notification.number += 1;
notification.flags |= Notification.FLAG_AUTO_CANCEL;
} else {
notification = new Notification(R.drawable.ic_stat_mintchip,
"This is a test",
System.currentTimeMillis());
notification.flags |= Notification.FLAG_AUTO_CANCEL;
notification.defaults |= Notification.DEFAULT_ALL;
notification.number += 1;
}
}
我不太清楚为什么会这样。有什么帮助吗?
【问题讨论】:
-
你能把你看到的截图贴在某处吗?
-
当然,一秒钟...imgur.com/07lxg
-
我假设你是 MintChip。我不太确定你为什么会得到这种效果。这是什么设备?请注意,虽然您的问题说您使用的是
Notification.Builder,但您的代码不是。您可以考虑使用 Android 支持项目中的NotificationCompat.Builder,看看是否有帮助。
标签: android notifications android-notifications android-notification-bar