Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to animate layouts?[Android]?

Tags:

android

layout

Here is what i want to do.

Lets say i have a parent linear layout and 3 childs in it.

{ ---------------- ++++++++++++++++ -------------- }

"+"/"-" are the layouts. What i want to do is this:

{------ ++++++++++++++++++++++++++++ -------} //1st step

{ ++++++++++++++++++++++++++++++++++++ } //2nd step..

Animate the layout "+" taking over the layouts - . The same end result as having these 3 layout height "fill_parrent" with weights and Setvisibility to "Gone" for the "-" layouts but animated

like image 289
weakwire Avatar asked Sep 11 '10 06:09

weakwire


1 Answers

You should look at http://developerlife.com/tutorials/?p=343 He gives very good examples on how to do something you want. I managed to create the move of the first layout to the top (he uses a left-to-right example). So you should move the first layout to the top, the third to the bottom and expand the middle layout after both are completed.

The only difficulty remaining is to get the LayoutParams right so that everything stays as you want it. In the end, you should have 3 animations: one that pushes the top layout off the top, one that does the some with the bottom and the last one that expands the middle one (if you don't want to animate it, you could just set the LayoutParams to both FILL_PARENT

like image 180
DrColossos Avatar answered Oct 17 '22 00:10

DrColossos