防止扩展的通知视图



我有此代码来设置我的通知:

    remoteViews = new RemoteViews(context.getPackageName(), R.layout.notification);
    mBuilder = new NotificationCompat.Builder(context);
    mBuilder.setSmallIcon(R.drawable.ic_stat_notification);
    mBuilder.setCustomContentView(remoteViews);
    mBuilder.setOngoing(true);
    mBuilder.setCategory(NotificationCompat.CATEGORY_PROGRESS);
    mBuilder.setPriority(NotificationCompat.PRIORITY_HIGH);
    mBuilder.setShowWhen(false);
    mBuilder.setStyle(new NotificationCompat.DecoratedCustomViewStyle());
    mBuilder.setAutoCancel(true);

您可以看到,我尚未通过调用mBuilder.setCustomBigContentView()来定义通知的扩展视图。然而,通知正在显示,箭头指向我的通知已扩展。我如何防止该箭头显示?

删除行

mBuilder.setStyle(new NotificationCompat.DecoratedCustomViewStyle());

我的个人解决方法是这个

mBuilder.setContentView(remoteViews);
mBuilder.setCustomBigContentView(remoteViews);

即。在大型通知视图中,在大内容视图中发送相同的远程视图

最新更新