Android setting: animateLayout

I create linearLayouts programmatically and would like them to fade out and disappear when visibility is set to visible / gone.

I can install

android:animateLayoutChanges="true" 

in the xml file, but since I create the views programmatically, I need to install it programmatically. How can i do this?

+55
android dynamic animation
Jun 05 '14 at 7:52
source share
2 answers

Use this code:

 container.setLayoutTransition(new LayoutTransition()); 

or

 LayoutTransition lt = new LayoutTransition(); lt.disableTransitionType(LayoutTransition.DISAPPEARING); container.setLayoutTransition(lt); 
+88
Jun 05 '14 at 8:02
source share

To turn off the fading effect, try the following:

 LinearLayout layout = (LinearLayout) findViewById(R.id.test_layout); layout.setLayoutTransition(null); 
+10
Oct. 14 '14 at 9:41
source share



All Articles