Android通知刷卡删除禁用

是否有可能从Android的通知列表中禁用Android通知的滑动删除function。 请帮帮我。

提前致谢。

  • 如何在通知栏中添加应用程序图标?
  • GCM的defaultSenderID
  • 开始和停止广播接收器的通知
  • 重启后的android通知
  • 在android中的报警pipe理器和通知
  • 通知恢复任务而不是特定的活动?
  • Android推送通知是否可靠?
  • Android通知在时间
  • 您可以将您的通知标记为“正在进行中”的通知。

    – > Notification.Builder setOngoing

    试试这个代码

    builder.setOngoing(true); // Cant cancel your notification (except notificationManager.cancel(); ) 

    以上代码在Notifcation Builder中。

     public void DisplayNotification() { // Use NotificationCompat.Builder to set up our notification. NotificationCompat.Builder builder = new NotificationCompat.Builder(this); //icon appears in device notification bar and right hand corner of notification builder.setSmallIcon(R.drawable.ic_stat_notification); // This intent is fired when notification is clicked Intent tapIntent = new Intent(CurrentActivity.this, SecondActivity.class); PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, tapIntent, 0); // Set the intent that will fire when the user taps the notification. builder.setContentIntent(pendingIntent); builder.setOngoing(true); // Cant cancel your notification (except NotificationManger.cancel(); ) // Content title, which appears in large type at the top of the notification builder.setContentTitle("Notifications Title"); // Content text, which appears in smaller text below the title builder.setContentText("Your notification content here."); NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); // Will display the notification in the notification bar notificationManager.notify(NOTIFICATION_ID, builder.build()); } 

    取消通知

     public void cancelNotification() { mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); mNotificationManager.cancel(NOTIFICATION_ID); // Notification ID to cancel } 

    快乐编码:)