【问题标题】:Setting up bigcontentview notification as default将 bigcontentview 通知设置为默认值
【发布时间】:2016-09-18 17:44:40
【问题描述】:

我正在使用以下代码来设置Bigcontentview。我不想要Contentview。我只想将Bigcontentview 显示为默认值

    RemoteViews bigViews = new RemoteViews(getPackageName(),
            R.layout.status_bar_expanded);
  status = new Notification.Builder(this).build();
        status.bigContentView = bigViews;
        status.flags = Notification.FLAG_ONGOING_EVENT;
        status.icon = R.drawable.ic_launcher;
        status.contentIntent = pendingIntent;
        startForeground(Constants.NOTIFICATION_ID.FOREGROUND_SERVICE, status);

是否可以通过任何方式将大内容视图设置为我的默认通知行为。

现在它显示一个空通知,当我展开时,它会展开完整通知。我怎样才能默认显示大内容视图通知?

【问题讨论】:

    标签: java android notifications


    【解决方案1】:

    您应该使用 RemoteViews 创建自己的自定义视图。

    RemoteViews customPushView = new RemoteViews(appContext.getPackageName(), R.layout.notification_layout_big);
    customPushView.setTextViewText(R.id.notification_title, "test title");
    customPushView.setImageViewBitmap(R.id.notification_image, bitmap);
    builder.setCustomContentView(customPushView);
    

    您可以在布局文件中指定高度。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-03-03
      • 1970-01-01
      • 1970-01-01
      • 2014-06-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多