bigtext时的通知样式错误

时间:2016-04-08 07:05:42

标签: android android-notifications

我正在显示来自以下代码的通知,但问题是当文字很小时它没有显示但是当文字很大然后显示

    NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context)
            .setSmallIcon(R.mipmap.app_icon).setContentTitle(title).setAutoCancel(true).setContentText(body)
            .setContentIntent(contentIntent);
    mBuilder.setStyle(new NotificationCompat.BigTextStyle(mBuilder).bigText(body));
    mBuilder.setPriority(Notification.PRIORITY_MAX);

    mBuilder.setVibrate(new long[]{1000, 1000, 1000, 1000, 1000});
    Uri soundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
    mBuilder.setSound(soundUri); // notification sound

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

    int notificationId = Integer.valueOf(last4Str);

    mNotificationManager.notify(notificationId, mBuilder.build());

0 个答案:

没有答案