我正在尝试使用操作按钮实现自定义通知
但是当我尝试实现这一点时,不会出现操作按钮和应用程序名称。
我的实现:
RemoteViews remoteViews = new
RemoteViews(getPackageName(),R.layout.emotions_notification);
Intent receiver = new Intent();
receiver.setAction("Action");
PendingIntent pendingIntentYes = PendingIntent.getBroadcast(this, 12345, receiver, PendingIntent.FLAG_UPDATE_CURRENT);
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this, "feelBetter.emotions")
.setContent(remoteViews)
.setContentIntent(pendingIntent)
.setSmallIcon(R.drawable.ic_status_bar)
.setPriority(NotificationCompat.PRIORITY_DEFAULT)
.setColor(Color.parseColor("#322176"))
.setLights(Color.parseColor("#322176"), 1000, 1000)
.addAction(R.drawable.common_google_signin_btn_icon_dark_normal, "Action", pendingIntentYes)
.setSound(uri)
.setAutoCancel(true);
notificationManager = NotificationManagerCompat.from(this);
// notificationId is a unique int for each notification that you must define
notificationManager.notify(id, mBuilder.build());
如何实施?