8

I want to implement a notification like this:

enter image description here

I know that I can use custom layout notification and set an onClickPendingIntent. But, is this the best option? If it is not, what is it? And if it is, how can I mimic the left square with the icon? Measures, color, etc.

Community
  • 1
  • 1
Brais Gabin
  • 5,827
  • 6
  • 57
  • 92

2 Answers2

2

Yes, that is the best option. Use RemoteViews to create your custom layout, and make sure to use onClickPendingIntent and not setContentIntent for UNDO action. If you use the second approach notification bar gets minimized and that's not something you want if you want to seamlessly update the notification once again after user presses UNDO like Gmail does.

If you want to align your icon with non-custom notifications use following dimensions: https://www.google.com/design/spec/patterns/notifications.html#notifications-content

njosa
  • 113
  • 9
0

I had the same question. What i did was in the PendingIntent activity/service create a new notification with the 'undo' button, etc.

change
  • 662
  • 1
  • 6
  • 11