Gridview improvements for "out of grid" items

The gridview is currently the best way to set up a basic list, but I ran into a few issues trying to use it for a carousel-type menu.

Here's the menu I have created:
menu

  1. gridview can't be configured to draw "offscreen" list items
    It would be nice if this were a flag given to the cell render function so we can choose whether or not to render them. To create the "hints" for the above and below cells in the menu above I was forced to crop my images so that there was some of each of the cells visible, allowing me to control the position of their render during the scroll.

  2. gridview doesn't have a "list padding"
    In the example above, I wanted the selected item to always be centered on the screen. However, when at the top or the bottom of the list, the gridview always aligns the selected item to the top or the bottom. Being able to add a configurable amount of padding to the top and/or bottom of the list would be very useful in this case and some other formatting cases. The workaround I used was to add an empty list item to the top and bottom of the list and prevent the user from scrolling to them.

  3. gridview examples in the docs lack proper imports
    This is a smaller issue but it makes it difficult to get started using gridview, because it has requirements that aren't listed under gridview (nineslice requires an import, and the draw functions require the graphics import)

3 Likes

+1 to this. I'm using a similar workaround by placing HorizontalDividers at the top and bottom of the view (surprisingly, addHorizontalDividerAbove(#rows + 1) is allowed), which might simplify your code a bit in some cases.