Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/225.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 未首先显示时的通知大小_Android_User Interface_Notifications_Alarmmanager_Remoteview - Fatal编程技术网

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();