In Android, GridView is nested in Scrollview, and there is only one row
There is a bug in Android project. There is only one row of GridView nested in Scrollview. The following Xiaobian found a solution on the Internet. The specific methods are as follows:
Method 1: as mentioned above, it is displayed by calculating the height and of sub columns in listview or GridView:
Method 2: override the onmeasure method of GridView and listview and directly give it a high enough height:
Override listview:
Override GridView:
Layout in XML:
The above is the solution that Xiaobian introduced to you that there is only one line of GridView nested in Scrollview in Android. I hope it will be helpful to you. If you have any questions, please leave me a message and Xiaobian will reply to you in time. Thank you very much for your support for the programming tips website!