签订自定义通知

时间:2015-07-06 15:24:46

标签: android notifications

我正在使用远程视图创建自定义通知。它运行良好,但如果另一个通知到达,那么我的自定义通知就会收缩。

有没有办法让它一直扩展?

我使用此代码:

 Notification.Builder builder = new Notification.Builder(MyContext);
 builder.setTicker("My ticker"); 
 ... other builder values ...     

 RemoteViews oRemoteViews = new RemoteViews(Contexto.getPackageName(), R.layout.my_notification_layout);
 oRemoteViews.setImageViewResource(R.id.myIcon, R.drawable.myicon); 
 oRemoteViews.setTextViewText(R.id.text1, "Other text here");
 ... other views values ...

 Notification oNotification = builder.build();
 oNotification.bigContentView = oRemoteViews;
 NotificationManager oNotificationManager = (NotificationManager) Contexto.getSystemService(Context.NOTIFICATION_SERVICE);
 oNotificationManager.notify("xxxxx", NOTIF_ID, oNotification); 

0 个答案:

没有答案