Color on the buttons of the Android notification

3

I have the following notification, and I would like to put a background color to the buttons that say accept and read more. How do you set them?

  

NotificationCompat.BigTextStyle style = new NotificationCompat.BigTextStyle ();

    style.setBigContentTitle("¡TITULO NOTIFICACION!");
    style.bigText(contenText);

    Intent intent = new Intent(MainActivity.this, NotificationActivity.class);
    Intent actionIntent = new Intent(MainActivity.this, ActionActivity.class);
    Intent actionIntent2 = new Intent(MainActivity.this, ActionActivity.class);
    TaskStackBuilder taskStackBuilder = TaskStackBuilder.create(getApplicationContext());
    taskStackBuilder.addNextIntent(intent);
    PendingIntent pendingIntent = taskStackBuilder.getPendingIntent(123, PendingIntent.FLAG_UPDATE_CURRENT);
    PendingIntent actionPendingIntent = PendingIntent.getActivity(this, 222, actionIntent, PendingIntent.FLAG_UPDATE_CURRENT);
    PendingIntent actionPendingIntent2 = PendingIntent.getActivity(this, 222, actionIntent2, PendingIntent.FLAG_UPDATE_CURRENT);

   NotificationCompat.Builder nBuilder = new NotificationCompat.Builder(this);
    nBuilder.setContentTitle("TITULO DE LA NOTIFICACION");
    nBuilder.setContentText("alalalalalalalalalalalala");
    nBuilder.setSmallIcon(R.drawable.ic_stat_name);
    nBuilder.setColor(Color.GREEN);
    nBuilder.setLargeIcon(BitmapFactory.decodeResource(getResources(),R.drawable.ic_launcher));
    nBuilder.setSmallIcon(R.drawable.ic_stat_name,55);
    nBuilder.setContentIntent(pendingIntent);
    nBuilder.setDefaults(Notification.DEFAULT_SOUND);
    nBuilder.setVibrate(new long[] {100, 2000, 500, 2000});
    nBuilder.setLights(Color.GREEN, 400, 400);
    nBuilder.addAction(R.drawable.ic_nodonar, "¡ACEPTAR!", actionPendingIntent);
    nBuilder.addAction(R.drawable.ic_nodonar, "Leer mas", actionPendingIntent2);
    nBuilder.setStyle(style);
    Notification notification = nBuilder.build();
    NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);

    nm.notify(1,notification);

    
asked by Nicolas Schmidt 20.06.2016 в 19:09
source

1 answer

1

Nico, good evening, look, I recommend that you do not use background or icon colors for notifications, since as Google specifies, some versions higher than Android lollipop 5.x will not be seen, since they only look in black and white

You can find more info here: Google Notifications 1

Stack overflow does not allow me to put another link :( It hurts that its rules are so strict, but you can search in google this: google materials, patterns notifications

I hope to help, greetings

    
answered by 14.09.2016 в 01:57