小编kam*_*mil的帖子

Android多图片样式通知与多行摘要文本

我正在尝试创建大图片通知,其中多个行摘要文本标记为红色,如下图所示

在此输入图像描述

我已经创建了大图片通知,但是我的摘要文本不是多行的,而是单行并且从最后剪切.如果有人知道,请指导.

    NotificationManager notificationManager = (NotificationManager)
            context.getSystemService(Context.NOTIFICATION_SERVICE);

    String title = context.getString(R.string.app_name);

    Bitmap remotePicture = null;
    Bitmap appIcon = null;

    // Create the style object with BigPictureStyle subclass.
    NotificationCompat.BigPictureStyle notiStyle = new NotificationCompat.BigPictureStyle();
    notiStyle.setBigContentTitle(title);
    notiStyle.setSummaryText(message);

    try {
        appIcon = BitmapFactory.decodeResource(context.getResources(), icon);
        remotePicture = BitmapFactory.decodeStream((InputStream) new URL(image).getContent());
    } catch (IOException e) {
        e.printStackTrace();
    }
 // Add the big picture to the style.
    if(remotePicture != null)
        notiStyle.bigPicture(remotePicture);

        // This ensures that the back button follows the recommended convention for the back key. …
Run Code Online (Sandbox Code Playgroud)

notifications android

7
推荐指数
0
解决办法
2838
查看次数

标签 统计

android ×1

notifications ×1