This is possible but the way you implement it depends on the API level you develop for.
For API levels below 11, you can set Notification.FLAG_NO_CLEAR. This can be implemented like this:
// Create notification
Notification note = new Notification(R.drawable.your_icon, "Example notification", System.currentTimeMillis());
// Set notification message
note.setLatestEventInfo(context, "Some text", "Some more text", clickIntent);
// THIS LINE IS THE IMPORTANT ONE
// This notification will not be cleared by swiping or by pressing "Clear all"
note.flags |= Notification.FLAG_NO_CLEAR;
For API levels above 11, or when using the Android Support Library, one can implement it like this:
Notification noti = new Notification.Builder(mContext)
.setContentTitle("Notification title")
.setContentText("Notification content")
.setSmallIcon(R.drawable.yourIcon)
.setLargeIcon(R.drawable.yourBigIcon)
.setOngoing(true) // Again, THIS is the important line
.build();
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…