I use LayoutTransitionwith custom objects ObjectAnimatorto animate the addition and removal of views inside LinearLayout(myself inside HorizontalScrollView). New images added to the right of previous views. The only property that is animated is translationX.
I would like the recently added one to Viewslip out from under the Viewimmediately preceding one (animation from left to right). And I would like the newly deleted one to Viewbounce back at the previous one View(animation from right to left).
I overloaded getChildDrawingOrder to return the reverse z-order, for example:
@Override
protected int getChildDrawingOrder( int childCount, int i ) {
return childCount - 1 - i;
}
This is great for animations that occur when Views are added. It does not work when uninstalling Views. removeView()called before getChildDrawingOrder(); ViewGroup(or, in my case LinearLayout) no longer knows about the recently deleted Viewby the time he finds out the order of z. As a result, the remote is Viewanimated on top of other views.
bringToFront()and bringChildToFront()seem to do nothing for me.
I know that I can just translate Viewwhich I want to delete and then call removeView(). But that defeats the purpose of using LayoutTransitions.
What else can I try to make sure that the removal Viewstill supports the z order that I want?