Implement expand and collapse notification android

后端 未结 5 1138
余生分开走
余生分开走 2021-02-01 15:44

I need to implement expand and collapse notification in status bar for android 4.0 and above version. I have search on google for this but didn\'t getting any code solution for

5条回答
  •  灰色年华
    2021-02-01 16:29

    I Couldn't able to set new instance of new NotificationCompat.BigTextStyle() in .setStyle() method of Notification. So I have used the below one, new instance of new Notification.BigTextStyle() in .setStyle().

          Notification builder =new Notification.Builder(this)
                        .setSmallIcon(Notification_icons[icon])
                        .setContentTitle(title)
                        .setContentText(description)
                        .setChannelId(channelID_Default)
                        .setOngoing(true)
                        .setStyle(new Notification.BigTextStyle()
                                .bigText(description))
                        .build();
    

提交回复
热议问题