创建通知时,通知操作按钮不可见

时间:2018-10-20 15:39:14

标签: java android notifications android-notifications

下面是我的代码,

 Integer notificationID = 2001;

 notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);



 notificationBuilder = new NotificationCompat.Builder(context);


        Intent openApp = new Intent(context,HomeActivity.class);

        PendingIntent pIntent = PendingIntent.getActivity(context,notificationID,openApp,PendingIntent.FLAG_UPDATE_CURRENT);


        Intent addThingsIntent = new Intent(context,ObjectAdd.class);

        PendingIntent addThingsPIntent = PendingIntent.getActivity(context,notificationID + 1,addThingsIntent,PendingIntent.FLAG_UPDATE_CURRENT);


        Intent addMoneyIntent = new Intent(context,MoneyAdd.class);

        PendingIntent addMoneyPIntent = PendingIntent.getActivity(context,notificationID + 3,addMoneyIntent,PendingIntent.FLAG_UPDATE_CURRENT);


        notificationBuilder
                .setSmallIcon(R.mipmap.ic_launcher)
                .setContentTitle("Things Place")
                .setContentText("Shortcuts")
                .setAutoCancel(true)
                .setContentIntent(pIntent)
                .addAction(R.mipmap.ic_launcher, "Add Things",
                addThingsPIntent)
                .addAction(R.mipmap.ic_launcher, "Add Money",
                addMoneyPIntent);


    notificationManager.notify(notificationID, notificationBuilder.build());

我在api 17中签入。操作按钮未显示。除操作按钮外,所有内容均可见。我还尝试过更改PendingIntent标记。

我也试图改变

该怎么办?

0 个答案:

没有答案