From 66ef1a201ea9df71a8ec9b2d1aaab1eb1180ae40 Mon Sep 17 00:00:00 2001 From: Chet Haase Date: Fri, 1 Jun 2012 15:09:07 -0700 Subject: 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 --- core/java/android/animation/LayoutTransition.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/core/java/android/animation/LayoutTransition.java b/core/java/android/animation/LayoutTransition.java index bdcb2af..4d3a519 100644 --- a/core/java/android/animation/LayoutTransition.java +++ b/core/java/android/animation/LayoutTransition.java @@ -831,6 +831,14 @@ public class LayoutTransition { return; } + // Don't animate items up from size(0,0); this is likely because the objects + // were offscreen/invisible or otherwise measured to be infinitely small. We don't + // want to see them animate into their real size; just ignore animation requests + // on these views + if (child.getWidth() == 0 && child.getHeight() == 0) { + return; + } + // Make a copy of the appropriate animation final Animator anim = baseAnimator.clone(); -- cgit v1.1