Reputation: 2481
I have a LinearLayout
that contains several views - when I add or remove it from my view I used the default LayoutTransition
.
I'm adding the view to my AppbarLayout - and I added the animations programmatically by setting a new LayoutAnimation on the appbar before adding the view and setting it to null after the view is added - I don't do it using the tag in the xml due to https://code.google.com/p/android/issues/detail?id=191170
The problem is that when i remove it from the view the default animation is done in two parts
Which change is needed to the LayoutTransition
in order to have only the 2nd animation where the view is closed from bottom to top?
Upvotes: 0
Views: 358
Reputation: 4911
Try this:
final LinearLayout container = (LinearLayout) findViewById(R.id.container);
LayoutTransition transition = container.getLayoutTransition();
transition.disableTransitionType(LayoutTransition.APPEARING);
transition.disableTransitionType(LayoutTransition.DISAPPEARING);
Upvotes: 0
Reputation: 3
Modify its LayoutParams to move it to the end position. Use getLayoutParams() on the View, cast it to the appropriate type based on its container, modify the LayoutParams object, then call setLayoutParams() on the View to commit the changes.
Upvotes: 0