Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

393
Vistas
Android max. size of custom notification

I'm trying to create some custom notifications for my app.

Usually collapsed view layouts are limited to 64 dp, and expanded view layouts are limited to 256 dp.

Although I considered these restrictions, it seems that the notification is cut off on several phones as you can see in the screenshots below. I did some research on that because I thought there are also restrictions depending on different manufacturers or UIs, but couldn't find anything.

That's how it is implemented:

// 64dp is set for height
val collapsedView = RemoteViews(packageName, R.layout.custom_notification_collapsed)
// 256dp is set for height
val expandedView = RemoteViews(packageName, R.layout.custom_notification_expanded)

val customNotification: Notification = NotificationCompat.Builder(this, "default")
        .setSmallIcon(R.drawable.ic_launcher_background)
        .addAction(R.drawable.ic_map, "Personal", PendingIntent.getService(this, 0, personalIntent, PendingIntent.FLAG_UPDATE_CURRENT))
        .addAction(R.drawable.ic_map, "Business", PendingIntent.getService(this, 0, businessIntent, PendingIntent.FLAG_UPDATE_CURRENT))
        .addAction(R.drawable.ic_map, "Work", PendingIntent.getService(this, 0, businessIntent, PendingIntent.FLAG_UPDATE_CURRENT))
        .setColor(Color.parseColor("#00D8FF"))
        .setStyle(NotificationCompat.DecoratedCustomViewStyle())
        .setCustomContentView(collapsedView)
        .setCustomBigContentView(expandedView)
        .build()

notificationManager.notify(4, customNotification)

Here's the result:

Xiaomi Mi Mix2

Samsung Galaxy Note 8

Now the questions are: Did I fail the implementation somehow? If not, is there a way to figure out the max. notification height for a current phone programmatically?

over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

Notification (your RemoteView) that you see is created by another process and only that process can know the size

There is no official way to get the max height for custom notification. I think the only way you can do is to reduce the text size

over 4 years ago · Santiago Trujillo Denunciar

0

They are cut off because of the actions you are adding try to remove the actions you will get your full 256/64 dp.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda