Resizing layouts programmatically (like animation) to "wrap_content"

I came across a very similar question, like here:

Resize layouts programmatically (like animation)

and the solution there is great, but I need another function.

I would like to animate resizing from height = 0 to height = WRAP_CONTEN. But I do not know how to measure the size of the contents of the package. So I need to somehow find that I reached this value or calculated it before resizing. Do you have an idea how to do this?

+7
source share
1 answer

Not sure if this is exactly what you are looking for, but you can define the width and height of layout_ as WRAP_CONTENT in xml, measure it in your constructor or onCreate, and then resize the layout to the size you need. By holding these values, you can return them to the size of WRAP_CONTENT in your animation.

+6
source

All Articles