在三星平板电脑的Android通知(4.1 +)中的BigContentView

Ash*_*raf 2 android android-notifications android-4.2-jelly-bean samsung-touchwiz

我正在使用big-contentview使用remoteViews通知消息.这个大内容视图在nexus 7中表现不错,但在三星10英寸平板电脑中显示出崩溃的布局.而像Google播放音乐等其他应用程序仅显示折叠通知.

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

1)Wther不支持tablet/samsung的bigcontentview.

2)或如何处理以在这种情况下显示折叠通知.

第一张图片:这是三星平板电脑的屏幕,那个大内容视图并不完全可见.

这是三星平板电脑的屏幕,那个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));
Run Code Online (Sandbox Code Playgroud)

Com*_*are 6

在三星上,你Notification不是最重要的.只有最顶层的Notification会自动显示扩展.

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


Mas*_*ter 5

您需要设置优先级:

mNotification.priority=NotificationCompat.PRIORITY_MAX;
Run Code Online (Sandbox Code Playgroud)