Reputation: 751
There are two functions to set notification icon setSmallIcon & setLargeIcon in NotificationCompat.Builder
I know that the small notification icon for mdpi density is 24x24dpi.
But what is the size of large notification icon for mdpi density?
Thank you.
Upvotes: 4
Views: 6635
Reputation: 6793
For setSmallIcon
refer to https://developer.android.com/guide/practices/ui_guidelines/icon_design_status_bar
Also the best way to create the icon is with the asset manger (file -> new -> image asset) in android studio, otherwise the icon might not dim properly.
For the setLargeIcon
I never used anything larger than 192x192 at xxxhdpi. It's pretty much a standard 48dp icon.
Upvotes: 1
Reputation: 199805
For every device, you can use android.R.dimen.notification_large_icon_height and android.R.dimen.notification_large_icon_height to get the appropriate size for the device:
int largeIconHeight = context.resources
.getDimensionPixelSize(android.R.dimen.notification_large_icon_height)
int largeIconWidth = context.resources
.getDimensionPixelSize(android.R.dimen.notification_large_icon_width)
In practice, all devices use a square shape, so the two dimensions are always the same.
Upvotes: 6