androidflexboxandroid-animationandroid-flexboxlayout

Android FlexboxLayout : android:animateLayoutChanges not working when child view resized


I added this option to my FlexboxLayout for had animation when children move :

android:animateLayoutChanges="true"

Unfortunately child view are animated only when I add child, but not when one child is resized! Have you got any idea to always have an animation?

enter image description here


Solution

  • To animate children when they change their size you need to enable CHANGING transition type of the container's layoutTransition:

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

    LayoutTransition