1

I have an animation list that is working fine, however it's using from the google default vector drawables:

enter image description here

As you can see these are the default vector drawables provided by google. It's the wifi drawable at different stages defined by the colors 0%, 33%, 66%, 99%. But as soon as I use custom drawables with photoshopped colors the animation-list longer works:

enter image description here

The above doesn't create an animation at all. All my java code is the same, the first picture is all imported .SVG second image is also all imported .SVG. How come the second one with custom images doesn't work?

DIRTY DAVE
  • 2,523
  • 2
  • 20
  • 83

1 Answers1

1

it appeas that you call it in onCreate() ,as mentioned in docs

It's important to note that the start() method called on the AnimationDrawable cannot be called during the onCreate() method of your Activity, because the AnimationDrawable is not yet fully attached to the window. If you want to play the animation immediately, without requiring interaction, then you might want to call it from the onStart() method in your Activity, which will get called when Android makes the view visible on screen.

check this for a similar sample

Edit what I have discovered is if your animation-list contains more the one vector, you have to change fillAlpha for at least one path to make animation works as I think in your converted files it's always android:fillAlpha="1" you can check the modified files here

Mohammed Alaa
  • 3,140
  • 2
  • 19
  • 21
  • I'm using it in ```NotificationCompat.Builder``` ```.setSmallIcon(R.animation.upload_animation)```. It works when I use the first animation list, but not the second list(with photoshopped drawables). – DIRTY DAVE Jan 21 '20 at 20:34
  • oh, I didn't know that you are using this in notification check [this](https://stackoverflow.com/questions/34037962/how-to-animate-the-progress-notification-icon/) I thinks it's close , or you can convert your images to vectors using [this](https://vectormagic.com/) site – Mohammed Alaa Jan 21 '20 at 21:12
  • I already said they are converted to vectors, but they are still not working. Both lists are vectors, except only the first list works. – DIRTY DAVE Jan 21 '20 at 21:21
  • I think there is a problem in the conversion, I can't imagine other scenario – Mohammed Alaa Jan 21 '20 at 21:27
  • How would there be a conversion issue when I am using the built in conversion: https://i.imgur.com/q2BVWFg.png – DIRTY DAVE Jan 21 '20 at 21:30
  • Changing the ```fillAlpha``` values fixed it, thanks. – DIRTY DAVE Jan 28 '20 at 07:45