Android notification height and width
-
03-12-2019 - |
Question
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?
Solution
the default notification bar height is 38 in hdpi, 25 in mdpi and 19 in ldpi
OTHER TIPS
You can create an xml layout for that notification, and that way control how big it is. Details can be found here.
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.