Reputation: 897
I'm making an app that displays a custom notification in the notification bar, and would like to show the user a preview of their notification from inside the activity that creates the notification.
Is there a way through the Android API to get the height in pixels, or dip
of a notification, so that I can match what the notification would look like as accurately as possible? Or does anyone know the height of notifications in Android 3.0 and later?
Upvotes: 2
Views: 6868
Reputation: 36289
These guidelines from the official documentation* will answer questions regarding which sizes a developer should use. Methods to get the actual size of a Drawable
can be found here.
*Note that the link is from an old/archived developer documentation - but now... 10 years later... it's saved off at MIT!
Upvotes: -1
Reputation: 3005
the default notification bar height is 38 in hdpi, 25 in mdpi and 19 in ldpi
Upvotes: 3
Reputation: 7385
You can create an xml layout for that notification, and that way control how big it is. Details can be found here.
Upvotes: 0