I've searched around for solutions to this problem, and the only answer I can find seems to be "don't put a ListView into a ScrollView". I have yet to see any real explanation for why though. The only reason I can seem to find is that Google doesn't think you should want to do that. Well I do, so I did.
So the question is, how can you place a ListView into a ScrollView without it collapsing to its minimum height?
Best Answer
Here's my solution. I'm fairly new to the Android platform, and I'm sure this is a bit hackish, especially in the part about calling .measure directly, and setting the
LayoutParams.height
property directly, but it works.All you have to do is call
Utility.setListViewHeightBasedOnChildren(yourListView)
and it will be resized to exactly accommodate the height of its items.