我正在按照以下方式构建服务中的通知进度条:
private NotificationManager mNotifyManager;
private NotificationCompat.Builder mBuilder;
mBuilder =
new NotificationCompat.Builder(DownloadService.this)
.setSmallIcon(R.drawable.download)
.setContentTitle("MayUp")
.setContentText("Downloading new tools")
.setTicker("Downloading in progress");
mBuilder.setAutoCancel(true);
Intent targetIntent = new Intent(DownloadService.this, ListClass.class);
TaskStackBuilder stackBuilder = TaskStackBuilder.create(DownloadService.this);
// Adds the back stack for the Intent (but not the Intent itself)
stackBuilder.addParentStack(MyActivity.class);
// Adds the Intent that starts the Activity to the top of the stack
stackBuilder.addNextIntent(targetIntent);
// PendingIntent contentIntent = PendingIntent.getActivity(DownloadService.this, 0, targetIntent, PendingIntent.FLAG_UPDATE_CURRENT);
// mBuilder.setContentIntent(contentIntent);
PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0,
PendingIntent.FLAG_UPDATE_CURRENT);
mBuilder.setContentIntent(resultPendingIntent);
mNotifyManager.notify(1, mBuilder.build());
mBuilder.setProgress(100, 0, false);
mNotifyManager.notify(1, mBuilder.build());
一切正常,通知和进度条都显示得很好。我想要简单的进度条在通知中,它是简单的,我对此没有问题,但我想要的是:
我想要的:
我希望我的通知图标能像Google Play商店应用程序一样动画化,以显示下载进度。我想做同样的事情。请告诉我如何使用builder和notification manager来实现这一点,我已经看了很多教程,但它们已经过时了。