我想在 android 的状态栏上显示数字作为文本。我已经设置了图标,但我想设置动态的数字。有没有可能做到这一点。
//Create the Notification
Notification notification = new Notification(android.R.drawable.stat_sys_warning, "Battery Indicator", System.currentTimeMillis());
//Create a PendingIntent to do something when the user clicks on the Notification
//Normally this would be something in your own app
Intent intent = new Intent();
intent.setClass(getApplicationContext(), BatteryIndicator.class);
PendingIntent pi = PendingIntent.getActivity(this, 0, intent, 0);
//Add the detail to the Notification
notification.setLatestEventInfo(getApplicationContext(),"Battery Indicator", "Charge level: " + batteryRemaining , pi);
//Display the Notification
NotificationManager notificationManager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(1, notification);