Android 未首先显示时的通知大小
我使用本地通知,比如带按钮的闹钟来控制它。我的问题是通知视图没有包装我的内容。所以在四处搜索之后,我发现有一个解决方法可以通过在构建之后设置视图来实现这一点。 大概是这样的:Android 未首先显示时的通知大小,android,user-interface,notifications,alarmmanager,remoteview,Android,User Interface,Notifications,Alarmmanager,Remoteview,我使用本地通知,比如带按钮的闹钟来控制它。我的问题是通知视图没有包装我的内容。所以在四处搜索之后,我发现有一个解决方法可以通过在构建之后设置视图来实现这一点。 大概是这样的: Notification notification = mBuilder.build(); // add remote view after build for getting bigger notification size notification.bigContentView = remoteViews; 除非通知
Notification notification = mBuilder.build();
// add remote view after build for getting bigger notification size
notification.bigContentView = remoteViews;
除非通知不是第一个通知,并且当通知不是顶部通知时,按钮不会显示,否则此项工作正常
即使通知不在通知列表的顶部,如何使通知内容自动换行?为显示大内容视图设置通知的最大优先级,如下所示
new Notification.Builder(this)
.setContentTitle("Media Player")
.setContentIntent(mPendingIntentHomeSong)
.setSmallIcon(R.drawable.app_icon)
.setPriority(Notification.PRIORITY_MAX)
.setContent(mNotificationContentView)
.setStyle(new Notification.BigPictureStyle()).build();