首页 > 解决方案 > Android:在状态栏中显示动画

问题描述

我想通过动画通知用户此服务正在状态栏中运行, 但无法显示动画或颜色

我看到了这些问题,但没有解决我的问题:

如何动画进度通知图标

通知栏自定义视图中的动画

Android - 显示动画状态栏图标

    notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);

    Notification.Builder builder = new Notification.Builder(this);
    builder.setAutoCancel(false);
    builder.setContentTitle(getText(R.string.app_name_persian));
//    builder.setContentText(getText(R.string.app_is_running));
    builder.setSmallIcon(R.drawable.notification_animation);
    builder.setOngoing(true);
    builder.setWhen(System.currentTimeMillis());

    notificationManager.notify(13, builder.build());

我的动画可绘制: 在此处输入图像描述

我所看到的: 在此处输入图像描述 在此处输入图像描述

标签: androidandroid-studioandroid-service

解决方案


推荐阅读