WHOATEMYNOODLES
WHOATEMYNOODLES

Reputation: 2643

Animation-list does not work with custom drawables

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?

Upvotes: 1

Views: 123

Answers (1)

Mohammed Alaa
Mohammed Alaa

Reputation: 3320

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

Upvotes: 1

Related Questions