Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

392
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!