2015-02-24 60 views
4

我试图在通知窗口中显示一个不确定的进度条。但它不显示。在通知中显示持续进度条,android?

这是我的代码

    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

有人能指导我出了什么问题?

+1

*公共Notification.Builder setProgress(INT MAX,INT进步,布尔不确定) **在API级别14 ***是什么你设备API水平? ... NotificationCompat未在旧API中添加通知的较新功能 – Selvin 2015-02-24 10:28:14

+0

您如何使其不可取消? – WISHY 2015-02-24 10:35:15

回答

3

解决只需要添加一个图标

.setSmallIcon(R.drawable.ic_notification);