How to animate the progress notification icon

前端 未结 3 1718
夕颜
夕颜 2020-12-18 08:34

I am building the notification progress bar in Service in such a way that is given below :

private NotificationManager mNotifyManager;
private NotificationCo         


        
3条回答
  •  鱼传尺愫
    2020-12-18 09:13

    you can make the animation list as described above in the answer of Rushab patel but there could be problem if you are using the newst api and if you are targetting the new sdk .

    so this following line would become outdated and deprecated

    Notification notification = new Notification(R.drawable.wheelAnim, null, System.currentTimeMillis());

    which is too bad in coding notification , I must suggest you as you have described above that you are using notification builder , thus I would recomend you to directly use this animation list drawable in the notification builder.

    from your snippet

    mBuilder =
                        new NotificationCompat.Builder(DownloadService.this)
                                .setSmallIcon(R.drawable.youAnimationList)
                                .setContentTitle("MayUp")
                                .setContentText("Downloading new tools")
                                .setTicker("Downloading in progress");
                mBuilder.setAutoCancel(true);
    

提交回复
热议问题