2015-02-24 37 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);