如何在通知栏中创建文本?

时间:2013-08-14 22:49:27

标签: android text statusbar android-notifications

从这张图片中我可以看到,我想创建一个在红色圆圈内的东西。如何在通知栏中创建文本?这是图片:http://tinypic.com/view.php?pic=23hu5xd&s=6

这是我的通知

notificationBuilder = new NotificationCompat.Builder(context);

                notificationBuilder.setOngoing(true);
                notificationBuilder.setContentTitle("Battery Stats Informations");
                notificationBuilder.setContentText("Carica residua: " +level+"%" + " " + "Temperatura: " +temperature+ "°C");
                notificationBuilder.setTicker("Battery level " +level+ "%");
                notificationBuilder.setWhen(System.currentTimeMillis());
                notificationBuilder.setSmallIcon(R.drawable.icon_small_not).setWhen(System.currentTimeMillis());
                Intent notificationIntent = new Intent(context, MainActivity.class);
                PendingIntent contentIntent = PendingIntent.getBroadcast(context, 0, notificationIntent, 0);
                notificationBuilder.setContentIntent(contentIntent);

                notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);

                Notification not=notificationBuilder.build();

                mNotificationManager.notify(SIMPLE_NOTIFICATION_ID,not);

由于

1 个答案:

答案 0 :(得分:0)

有N个图标,每个图标对应您要显示的每个不同“文字”,并使用Notification.Builder setSmallIcon()来电中的相应图标。

IOW,你所看到的不是“文字”,而是“碰巧有数字的图像”。