2014-03-07 43 views
0

我創建的通知是這樣的:的Android 4.0.3的通知缺少操作

NotificationManager notifyManager = (NotificationManager) App 
     .getContext().getSystemService(Context.NOTIFICATION_SERVICE); 
    NotificationCompat.Builder builder = new NotificationCompat.Builder(
     App.getContext()); 
    builder.setSmallIcon(R.drawable.ic_launcher); 
    builder.setContentTitle(task.getFileNode().getName()); 
    Intent cancelIntent = CancelDownloadReceiver 
     .getCancelDownloadIntent(ticketUUID); 
    PendingIntent intent = PendingIntent.getBroadcast(
     App.getContext(), 0, cancelIntent, 
     PendingIntent.FLAG_UPDATE_CURRENT); 
    builder.addAction(
     R.drawable.ic_stat_cancel, 
     App.getContext().getString(
      R.string.notification_download_cancel), 
     intent); 
    builder.setProgress(0, 0, true); 
    Notification notification = builder.build(); 
    notification.flags = Notification.FLAG_ONGOING_EVENT; 
    notifyManager.notify(ticketUUID, 1, notification); 

問題是,摩托羅拉XOOM採用Android 4.0.3缺少操作。爲什麼?正如你所看到的,我正在使用支持庫中的類。

+0

你的問題是什麼? –

+0

提到的設備上缺少通知中的@SimplePlan操作按鈕。在具有4.2.2 +的仿真器上出現(沒有檢查4.1版本)。我知道它是API 16功能,但我使用的支持庫,所以它必須工作。 – Lingviston

回答

2

儘管它位於支持庫中,但它不適用於Android 4.0.x.請參閱documentation:「操作按鈕不會出現在Android 4.1之前的平臺上」。

+0

thx,沒有檢查它。是否有任何解決方法將按鈕放置在通知中? – Lingviston

+0

不,沒有解決方法。 – Saket