2

This question is related with

setColor small icon notification android

Android N notification title and icon color is darker

But we didnt find any workaround yet.

enter image description here

When setting color for smallIcon and Title, Android seems don't respect the color we had choose. Searching on web and source code, seems that Android manipulate the color before show, to get the right contrast between background and icon.

But how can other apps like whatsapp, Linkedin and Twitter use their right colors? Note that both icon and text are wrong, so isn't something related with image format.

My code

   //accent should show a lighter version of blue and not that one
   //drawable is hiden, but the original was generated with android studio
    val notificationBuilder = NotificationCompat.Builder(this, channelID)
            .setSmallIcon(R.drawable.test)
            .setColor(ContextCompat.getColor(this, R.color.accent))
            .setContentTitle("fake title 01")
            .setContentText("fake body 01")
            .setPriority(NotificationCompat.PRIORITY_HIGH)
cesarsicas
  • 437
  • 1
  • 5
  • 17

0 Answers0