Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Play Music style GridView

I'm looking to create a music app and I'd like to make a GridView similar to what Google Play uses where they inject elements that will span rows and columns like the Soilwork album does in this screenshot:

Google Play Music

I've thought about using a ListView and populating rows with custom elements, but I couldn't think of a good way to use that with ViewHolder pattern, or really a way to make that reusable and account for differing number of items in width based on screen size (for example, the grid is only two items wide on phones, and "large" items span both columns and only one row).

I've also thought about using a ScrollView filled with custom ViewGroups, but that seems to run into the same issues I previously mentioned.

I next thought about using GridLayout, but that doesn't accept ListAdapters, and doesn't seem tuned to the kind of usage I'm looking at (nor does it seem to scroll)

I'd greatly appreciate if anyone could give me somewhere to start on this, or could point me to a library that does this. I've already checked out StaggeredGridView but it doesn't seem to accomplish what I'd like. My ideal solution would be a view which lays out items on an even grid like GridView and accepts view from a ListAdapter, also like GridView, but allow for elements to span, using the single cell constraint of GridView as the default behaviour.

Cheers.

EDIT

I have a perfectly functioning GridView as shown below, but I'd like to make items at regular intervals (every nth item) span more than one column and/or row, as shown in the previous screenshot.

Working GridView

like image 368
berwyn Avatar asked Nov 12 '22 22:11

berwyn


1 Answers

Check out Parchment. GridDefinitionView may help you achieve the UI you are looking to build.

like image 72
Suraj C Avatar answered Nov 15 '22 13:11

Suraj C