【问题标题】:Removing the secondary icon from android notification从 android 通知中删除辅助图标
【发布时间】:2014-10-07 10:28:41
【问题描述】:

如何删除通知右下角的次要小图标?因为通知需要调用 setSmallIcon 方法,所以不能只删除对该方法的调用。

有没有什么方法可以删除辅助图标,同时将其保留在状态栏上?我们是否必须调用 setStyle 并为通知设置自定义样式?

【问题讨论】:

  • 什么是“通知右下角的小图标”?您可能希望在某处上传屏幕截图并从您的答案中链接到它。
  • @CommonsWare 我想他在谈论这个:i.imgur.com/4qe3jSB.jpg 有什么想法吗?
  • 你做到了吗?

标签: android notifications icons


【解决方案1】:

我就这样摆脱了它(适用于 Android 5 及更低版本):

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

Bitmap notificationLargeIconBitmap = BitmapFactory.decodeResource(
                context.getResources(),
                R.drawable.notification_icon_big);

NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context)
                .setSmallIcon(R.drawable.ic_notification_systray)
                 //.setLargeIcon(notificationLargeIconBitmap)
                .setContentTitle(context.getString(R.string.app_name))
                .setContentText(msg)
                .setColor(context.getResources().getColor(R.color.blue))
                .extend(new NotificationCompat.WearableExtender().setBackground(notificationLargeIconBitmap));

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-04-05
    • 1970-01-01
    • 2011-02-19
    • 2016-02-02
    • 2022-01-12
    相关资源
    最近更新 更多