In an experimental project I am working on I am trying to make a GridView that is wider then the actual screen and is scrollable both horizontal and vertical where all “boxes” are equally sized. For no I am strugling with getting the GridView to scroll Horizontaly and stay perfectly squared, and completely next to each other.
How can I fix this?
GridViewis not designed to scroll horizontally. You are welcome to try putting aGridViewin aHorizontalScrollView, and if you are lucky, it will work.GridViewgives you explicit control over the size of columns, in the form of attributes likeandroid:columnWidth. The heights of the rows are based upon what you put into the rows — it is up to you, therefore, to ensure that you set your column width to be the same as the row height.All that being said, please bear in mind that the built-in widgets and containers are not designed to handle every possible scenario. Depending upon what you are doing, you may be better served either trying a different approach (e.g., using a 2D game engine that supports the notion of horizontally and vertically scrolling maps) or creating your own widgets that meet your needs.