Why isn’t my animation running?Mon, Dec 05, 12:00 AM
Note: this post is quite old now. As you can see below this isn't an issue from Android 7.0.
Let me tell you a story about something I spent a fair amount of time debugging last year. I had totally forgot about it until the other day when someone mentioned something they were seeing with Snackbar, and it turned out to be the same thing.
So what is the issue? Well it’s easier if I show you:
You’ll see notice that I’m just opening an Activity here on click. There are a number of TextInputLayouts, the first of which jumps into place after 200ms or so.
So why the visual jump? TextInputLayout is simply running an animation and invalidating itself, and after debugging, that animation was indeed running fine.
Well it turns out that there was a performance optimization added to the framework in Android 4.0 which allowed your view hierarchy only one single draw pass before the Activity animation was started. Once the Activity animation has ended, your view hierarchy is drawn every ~16ms as you expect.
Thankfully, that optimization has been removed from the framework in Android 7.0, resulting in the following happening instead:
So why am I telling you this? Well it’s just something to be aware of if you’re trying to debug why your view isn’t being updated during the initial opening of your Activity.