问题
I try to show a notification in Android, and use the code from this Link. In some source people said that the icon should be totally white and some source said I should use .png instead of vector.
I try all of this ways but no one didn't help me.
I try this code:
Notification newMessageNotification =
new Notification.Builder(mContext)
.setSmallIcon(R.drawable.ic_message)
.setContentTitle(getString(R.string.title))
.setContentText(getString(R.string.content))
.addAction(action))
.build();
回答1:
after search about 1 hour in all the question with this topic finally I find out it's because of my android version! look at the image below. In Api level 24 an above, there is no icon in design!!
回答2:
With Nougat they have changed design of Notification icons
https://android-developers.googleblog.com/2016/06/notifications-in-android-n.html
You’ll note that the icons are not present in the new notifications; instead more room is provided for the labels themselves in the constrained space of the notification shade. However, the notification action icons are still required and continue to be used on older versions of Android and on devices such as Android Wear.
回答3:
Notification icons must be entirely white
If you want to support Lollipop Material Icons then make transparent icons for Lollipop and above version. Please refer following https://design.google.com/icons/
来源:https://stackoverflow.com/questions/44558501/notification-action-icon-didnt-show