繁体   English   中英

动作按钮在android通知中不可见

[英]action button not visible in android notification

我正在尝试像这样自定义android通知。

在此输入图像描述

以上API23的一切正常。 对于以下API23操作按钮不可见。 我没有发现我的代码有什么问题。

这是我在API23下面的示例代码

RemoteViews expandedView = createMultiRemoteViews(context,
                R.layout.notification_multiview_b23, icon, "Custom notification", "This is a custom layout", leftImage, rightImage, "09:10", "16:23");

expandedView.setOnClickPendingIntent(R.id.left_image, leftImageIntent);
expandedView.setOnClickPendingIntent(R.id.right_image, rightImageIntent);

NotificationCompat.Action addToWatchListAction = new NotificationCompat.Action.Builder(R.drawable.ic_bookmark_border_black_24dp,
                LABEL_ADD_TO_WATCH_LIST, addToWatchList).build();

NotificationCompat.Builder builder = createNotificationBuider(context, "Custom notification", "This is a custom layout", icon);
builder.addAction(addToWatchListAction);
builder.setCustomBigContentView(expandedView);

showNotification(context, builder.build(), MULTI_NOTI_ID);

API 24下面没有通知操作。这可能是兼容性问题。 要支持向后兼容性,请使用支持库的NotificationComapt类。 这里有一个链接到官方文件和链接链接到支持库类。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM