I have a list view that is populated with data from a web request. While waiting for the response I overlay another view on top (mNoDataLayout
) with a progress bar and other information telling the user the data is coming. Once the data arrives I want to fade out the overlay view to reveal the populated list view:
mNoDataLayout.animate().setDuration(300).alpha(0.f);
The problem is this animation doesn't always run. Sometimes is works, sometimes it doesn't.
The fix was to set the height of my overlay view
mNoDataLayout
to the screen height. Previously I had it set tomatch_parent
which meant that when lots of list data arrived, the list view could be very large, which caused the overlay view to be very large.Once I set my overlay view to be smaller, the alpha animation started working without any other changes.
Perhaps Android is silently killing alpha animations on very large views in order to optimise rendering fill rate. But since those pixels are offscreen anyway, this probably implies it's also not doing any scissoring / culling, which seems odd.
This was on a Samsung Galaxy Note 4.