I currently have a GridView scrolling vertically, and everything works fine. But now that I want to change my layout and have the gridview grow on its width instead of height as it grows bigger I am lost.
I have tried to simply change the column width each time an item is added to the gridview. But no vertical scroll appears, even though the items are added correctly. Is there a neat way to fix this, or must I make my own gridview? :(
Cheers,
You can try putting the GridView in a HorizontalScrollView . You may try to set fixed height to the GridView inside the HorizontalScrollView . Then you can dynamically calculate the number of columns of the GridView based on your content and use setNumColumns(int) method to set it. Great idea!
Just wrap the GridView with a div having overflow style defined, i.e. use div to have scrollbars inside the GridView. You can change overflow:auto to overflow:scroll but that will always show both scrollbars.
You may want to change the scroll direction when the GridView is displayed in landscape mode. Setting scrollDirection to Axis. horizontal will do just that.
But now that I want to change my layout and have the gridview grow on its width instead of height as it grows bigger
I do not believe GridView
supports that -- sorry!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With