Pergunta

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?

Foi útil?

Solução

the default notification bar height is 38 in hdpi, 25 in mdpi and 19 in ldpi

Outras dicas

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top