只是一个简单的问题:如何使单行通知在短时间内消失。
就像 Whatsapp 的一样:
我目前的通知代码还是很基础的:
Intent intent = new Intent("com.example.MyChat");
PendingIntent pIntent = PendingIntent.getActivity(context, 0, intent, 0);
Notification notification = new Notification.Builder(context)
.setContentTitle("New message from " + name)
.setContentText(message)
.setSmallIcon(R.drawable.ic_launcher).setContentIntent(pIntent)
.getNotification();
notification.defaults |= Notification.DEFAULT_SOUND;
NotificationManager notificationManager = (NotificationManager) context
.getSystemService(context.NOTIFICATION_SERVICE);
notificationManager.notify(0, notification);
谢谢