ZakTaccardi
ZakTaccardi

Reputation: 12467

Is android:animateLayoutChanges supposed to work when a child view's height is updated?

http://developer.android.com/training/animation/layout.html

<LinearLayout
  animateLayoutChanges="true">
     <View1/> 
     <View2/>
     <View3/>
</LinearLayout>

Let's say View2's height increases at runtime. I would expect View3 to animate downward. Instead, it snaps directly into its new position.

Why does my desired animation not occur?

Upvotes: 5

Views: 3501

Answers (1)

Rishabh876
Rishabh876

Reputation: 3180

According to https://developer.android.com/reference/android/animation/LayoutTransition.html

By default, all transition types except CHANGING are enabled.

So if you want to animate when a child changes its size. You can do so by

LayoutTransition layoutTransition = new LayoutTransition();
layoutTransition.enableTransitionType(LayoutTransition.CHANGING);
parentView.setLayoutTransition(layoutTransition);

Upvotes: 8

Related Questions