How to scale the view to fit the content size in Android animation?

Viewed 1939

I am using CardView as a item of Recycler Adapter.

At first, all items will not show the whole content, (I cut it and put the '... ...' instead)
but after click it, the clicked item will scale its height to fit the content height. ( Here I set the text to the whole content and hope the card can scale to fit it )

looks like:

enter image description here

I know how to animate the height to the specific target height.. but in this case, I don't know how to measure the height needed to show the whole content, each item should have different target height.

How can I do it?

2 Answers
Related