【问题标题】:Android notification: the top notification is not expandedAndroid通知:顶部通知未展开
【发布时间】:2016-06-08 20:52:41
【问题描述】:

根据下面的代码,我创建了一个可扩展的通知。 私人无效横幅通知(){ 通知前台注; RemoteViews bigView = new RemoteViews(getApplicationContext() .getPackageName(), R.layout.banner_notif);

    Bitmap icon = BitmapFactory.decodeResource(getResources(),
            R.drawable.featuredimagehandler);

    NotificationCompat.Builder mNotifyBuilder = new NotificationCompat.Builder(
            this);
    foregroundNote = mNotifyBuilder.setContentTitle("Title")
            .setContentText("Description")
            .setSmallIcon(R.drawable.app_icon).setLargeIcon(icon).build();

    foregroundNote.bigContentView = bigView;
    NotificationManager mNotifyManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
    mNotifyManager.notify(2, foregroundNote);
}

据此document

仅当通知展开时才会显示通知的大视图,这发生在通知位于通知抽屉顶部时,或者当用户使用手势展开通知时。

问题是当这个通知放在顶部时,它没有展开。

【问题讨论】:

  • 您找到解决方案了吗?

标签: android notifications android-notifications


【解决方案1】:

我遇到了这个问题,问题是我为通知创建的布局的高度为“MATCH_PARENT”,因此它太大而无法容纳。将高度设置为合理的值即可解决问题并扩展通知。

【讨论】:

    【解决方案2】:

    我在远程视图和通知方面也有类似的东西。我的最终没有扩展,因为我的 notification_id 在我的应用程序中不是唯一的:)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-09-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-11-06
      • 1970-01-01
      相关资源
      最近更新 更多