iTwenty
iTwenty

Reputation: 973

Get height of children set to wrap_content when the height of layout itself is zero

I am trying to make the rows of my listview such that clicking on any one expands that row in place and shows extra options. I use an extra layout (let's call it expandView) contained with the row layout (call it rowView) with height set to zero initially and use a valueanimator to expand it to the final height when rowView is clicked.

Problem is, I have no idea what the final height is going to take until the user actually clicks the rowView. So I cannot specify some fixed end value for the animation, nor can I sum up the heights of expandView's children on rowView click since they too return zero when expandView's height is zero.

I really want to avoid hardcoding the height values for expandView or it's children here. Any pointers?

Upvotes: 1

Views: 466

Answers (1)

iTwenty
iTwenty

Reputation: 973

Figured it out. This answer given here helped. I have to call call measure() followed by getMeasuredHeight() to get the final height of my expandView.

Upvotes: 1

Related Questions