2

我正在使用 big-contentview 使用 remoteViews 通知消息。这个大内容视图在nexus 7中显示良好,但在三星10“平板电脑中显示为折叠布局。而其他应用程序(如谷歌播放音乐)仅显示折叠通知。

我用 SM-T520 (10" 平板电脑) 进行了测试

1) 平板/三星不支持 bigcontentview。

2)或者如何处理在这种情况下显示折叠的通知。

第一张图:这是三星平板电脑屏幕,bigcontentview 不完全可见。

这是三星平板电脑屏幕,bigcontentview 不完全可见。

第二张图片:预期输出。

预期产出

layout-v16 我有扩展布局。

layout-v11 我已经折叠了布局。

代码(Java):

     mNotificationTemplate = new RemoteViews(mContext.getPackageName(),
            R.layout.notification_download_latest);

    if (NotificationHelper.hasHoneycomb()) { // Notification Builder
        mNotification = new NotificationCompat.Builder(mContext)
                .setSmallIcon(R.drawable.ic_launcher)
                .setContentIntent(getPendingIntent(mContext, url))
                .setPriority(Notification.PRIORITY_DEFAULT)
                .setOngoing(true).setContent(mNotificationTemplate).build();
        if (NotificationHelper.hasJellyBean()) {
            // Expanded notifiction style
            // mExpandedView = new RemoteViews(context.getPackageName(), //
            // R.layout.notification_download_latest);

            **mNotification.bigContentView = mNotificationTemplate;**
            mNotificationTemplate.setOnClickPendingIntent(
                    R.id.notification_cancelBtn,
                    getPendingIntent(mContext, url));
4

2 回答 2

6

在三星上,你Notification不在顶部。只有最上面的Notification会自动展开显示。

因此,这种行为是完全正常的。

于 2014-08-22T12:55:16.613 回答
5

您需要设置优先级:

mNotification.priority=NotificationCompat.PRIORITY_MAX;
于 2014-11-15T21:28:05.400 回答