Skip to content

Commit 66ef1a2

Browse files
committed
Skip LayoutTransition animations on objects of size (0,0)
LayoutTransition runs changing animations on all objects that change between now and the next layout. This works in most normal situations, but when a container is becoming visible, or being added to its container, or other first-time situations, then some of the views and parent hierarchy may be of size (0,0). The user really shouldn't need to see an animation up from these nonsense values, so we just skip running the animation on these objects and simply place the objects where they need to go. Issue #6597648 view should not animate up from size (0,0) Change-Id: I2c355a68bf1ce3b41fbec01ad95c78d83562ba32
1 parent 79f7381 commit 66ef1a2

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

core/java/android/animation/LayoutTransition.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -831,6 +831,14 @@ private void setupChangeAnimation(final ViewGroup parent, final int changeReason
831831
return;
832832
}
833833

834+
// Don't animate items up from size(0,0); this is likely because the objects
835+
// were offscreen/invisible or otherwise measured to be infinitely small. We don't
836+
// want to see them animate into their real size; just ignore animation requests
837+
// on these views
838+
if (child.getWidth() == 0 && child.getHeight() == 0) {
839+
return;
840+
}
841+
834842
// Make a copy of the appropriate animation
835843
final Animator anim = baseAnimator.clone();
836844

0 commit comments

Comments
 (0)