I have read the all the answers here:How can I put a ListView into a ScrollView without it collapsing?But it seems no one cares why the ListView get collapsed when put in a ScrollView.I think something happens to the onMeasure() method but I'm not sure of it.So,does anyone have any idea?
Asked
Active
Viewed 408 times
0
-
Just a suggestion, a list inside a scroll view is most of the time (if not always) a bad idea :) – Claudio Redi Nov 01 '16 at 12:15
-
Thank you for the suggestion,and I will pay more attention to it.But do you have any idea why the listview collapses? – alphacat2018 Nov 01 '16 at 12:31
-
You should avoid that. Explaining your context maybe can help us to suggest an alternative solution – fillobotto Nov 01 '16 at 13:10
2 Answers
1
Your aproach is not very good. As you did't describe your situation, i can't say exactly what you need. But anyway i will suggest to use Headers and footers instead of puttings scrollable listView in ScrollView. But if you need that anyway, i suggest to use RecyclerView and NestedScrollView instead, as it handles a lot of scrolling issues.

Arsen Sench
- 438
- 4
- 18
0
Android doesn't support putting scrollable UI component as a child to other scrolable UI component. Since ListView
is scrollable by default, that might be the problem. Hence, all the suggestions not to use ListView
as a child to ScrollView

Zozinski
- 73
- 8