【问题标题】:Display a continuing progress bar in notification, android?在通知中显示一个持续的进度条,android?
【发布时间】:2015-02-24 10:15:56
【问题描述】:

我正在尝试在通知窗口中显示不确定的进度条。但它不显示。

这是我的代码

                    int id = 1;
                NotificationManager mNotifyManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
                Builder mBuilder = new NotificationCompat.Builder(
                        MenuActivity.this);
                mBuilder.setContentTitle("My app")
                        .setContentText("Download in progress");
                mBuilder.setProgress(0, 0, true);
                // Issues the notification
                mNotifyManager.notify(id, mBuilder.build());

我正在关注此链接 Continuing Activity Indicator

有人可以指导我出什么问题吗?

【问题讨论】:

  • public Notification.Builder setProgress (int max, int progress, boolean indeterminate) 在 API 级别 14 中添加 你的设备 API 级别是什么? ... NotificationCompat 没有在旧 API 上添加 Notification 的新功能
  • 如何让它不可取消?

标签: android notifications progress-bar


【解决方案1】:

解决了只需要添加一个图标

.setSmallIcon(R.drawable.ic_notification);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-02-07
    • 1970-01-01
    • 1970-01-01
    • 2018-01-09
    • 2014-06-14
    相关资源
    最近更新 更多