在某些手机上,自定义通知没有 collapse/expand 的箭头
On some phones custom notification doesn't have an arrow for collapse/expand
我尝试为我的测试项目创建自定义通知。我有 collapse/expand 视图的远程视图。我的简单代码是
public static void send(Context context, RemoteViews collapsedView, RemoteViews expandedView) {
Notification notification = new NotificationCompat.Builder(context, NOTIFICATION_CHANNEL_ID)
.setContent(collapsedView)
.setCustomContentView(collapsedView)
.setCustomBigContentView(expandedView)
.setSmallIcon(R.mipmap.ic_launcher)
.setStyle(new NotificationCompat.DecoratedCustomViewStyle())
.setOngoing(true)
.build();
getNotificationManager(context).notify(0, notification);
}
此代码运行完美,但我无意中注意到 在某些手机上(android 6.0) 当我收到自定义通知时它没有操作箭头 collapse/expand.
你能帮帮我吗?
另外 当我发送自定义通知时,我看到:
1)第一个状态是展开的,不是折叠的(很奇怪)
2) 没有折叠的动作箭头
我将此代码用于我的通知,我认为我在使用 Andorid 6.0 时没有这个问题:
Notification notification = new Notification.Builder(MainActivity.this)
.setContentTitle("Some title")
.setContentText("Some text")
.setSmallIcon(R.mipmap.ic_launcher_round)
.setSound(uriSound)
.setVibrate(new long[]{0, 100, 20, 100})
.setShowWhen(true)
.setContentIntent(mainIntent)
.setStyle(new Notification.BigTextStyle()
.bigText("Some other text"))
.setAutoCancel(true)
.build();
我尝试为我的测试项目创建自定义通知。我有 collapse/expand 视图的远程视图。我的简单代码是
public static void send(Context context, RemoteViews collapsedView, RemoteViews expandedView) {
Notification notification = new NotificationCompat.Builder(context, NOTIFICATION_CHANNEL_ID)
.setContent(collapsedView)
.setCustomContentView(collapsedView)
.setCustomBigContentView(expandedView)
.setSmallIcon(R.mipmap.ic_launcher)
.setStyle(new NotificationCompat.DecoratedCustomViewStyle())
.setOngoing(true)
.build();
getNotificationManager(context).notify(0, notification);
}
此代码运行完美,但我无意中注意到 在某些手机上(android 6.0) 当我收到自定义通知时它没有操作箭头 collapse/expand.
你能帮帮我吗?
另外 当我发送自定义通知时,我看到: 1)第一个状态是展开的,不是折叠的(很奇怪) 2) 没有折叠的动作箭头
我将此代码用于我的通知,我认为我在使用 Andorid 6.0 时没有这个问题:
Notification notification = new Notification.Builder(MainActivity.this)
.setContentTitle("Some title")
.setContentText("Some text")
.setSmallIcon(R.mipmap.ic_launcher_round)
.setSound(uriSound)
.setVibrate(new long[]{0, 100, 20, 100})
.setShowWhen(true)
.setContentIntent(mainIntent)
.setStyle(new Notification.BigTextStyle()
.bigText("Some other text"))
.setAutoCancel(true)
.build();