Solutions to problems with listview or GridView nested under Android Scrollview
Solutions to problems with listview or GridView nested under Android Scrollview
Nested listview or GridView under Scrollview will send columns, and only one row of data can be displayed. Because they are both scroll structures, two scroll bars put together will cause conflict.
This problem can be solved by calculating the height of listview or overriding the onmeasure method of listview. The following describes how to solve the problem by overriding the onmeasure method.
Override the onmeasure method as follows:
Scrollview needs to pay attention to:
1. Scrollview only supports vertical scrolling.
2. Scrollview can only add one child control. What if there are multiple child controls? Just set another layer of LinearLayout directly outside these child controls.
The above is the solution to the problem of Scrollview nesting in Android development. If you have any questions, please leave a message or go to the community of this site for communication and discussion. Thank you for reading. I hope it can help you. Thank you for your support to this site!