Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resizing layouts programatically (as animation) up to "wrap_content"

I'm facing very similar issue as here:

Resizing layouts programmatically (as animation)

and the solution there is great but I need one more feature.

I'd like to animate the resizing from height = 0 to height = WRAP_CONTEN. But have no idea how to measure the wrap content size. So I need somehow detect that I've reached this value or calculate it before resizing. Do you have idea how to do it?

like image 949
obrien Avatar asked Dec 16 '11 14:12

obrien


1 Answers

Not sure if this is exactly what you're looking for, but you could define the layout_ width and height as WRAP_CONTENT in the xml, measure it in your constructor or onCreate, and then resize the layout to your desired size. Holding on to those values, you could return it to the WRAP_CONTENT size in your animation.

like image 179
Tom Quinn Avatar answered Nov 15 '22 06:11

Tom Quinn