I'm trying to animate the add/remove actions of the views of an LinearLayout
that has it's height set as wrap_content
.
Currently I've tried setting android:animateLayoutChanges="true"
for the LinearLayout and programmatically enabling the transitions like this:
LayoutTransition transition = new LayoutTransition();
transition.setDuration(300);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
transition.enableTransitionType(LayoutTransition.APPEARING);
transition.enableTransitionType(LayoutTransition.DISAPPEARING);
transition.setAnimateParentHierarchy(true);
}
container.setLayoutTransition(transition);
The Appearing seems to work very smooth and it animates and resizes as I want.
The issue I'm having is with Disappearing as the LinearLayout
container is resized before the remove animation is finished.
I've also tried playing around with the setAnimateParentHierarchy()
and it doesn't seem to really affect on how and when the resize of the container is done.