TLDR version:
We have an array of ItemAs and a second array of ItemBs. We want to display them in a single scrollable 'list' on the screen, but hopefully keeping their management, etc. separate.
Full Question:
Consider you have two lists of data you want to show together in one scrollable area on the screen. You can't simply place two ListViews in a vertical LinearLayout because the lists scroll individually, not as one union list. What we want is one scrollable region that contains both lists (i.e. the LinearLayout is what's actually scrolled, but the two lists inside it are fully expanded.)
e.g.
ItemTypeA
ItemTypeA
ItemTypeA
ItemTypeA
ItemTypeB <-- Note the second 'data' list starts here but is in the same UI list.
ItemTypeB
ItemTypeB
ItemTypeB
ItemTypeB
ItemTypeB
I also don't mind if the 'rows' aren't recycled (i.e. they still exist when scrolled off the screen) since there aren't that many of them (maybe 25 or so: ~10 of the first type, then ~15 of the second type.)
Now in a perfect world, I could simply tell the ListViews to not scroll, hoping they would 'expand out' but didn't get anywhere there.
I also just tried a straight-up vertical LinearLayout where I manually inserted the rows, but that made maintenance a nightmare.
The final thing I tried is just using one ListView, but combining the data from the two lists into a single array and going from there. It works but it just feels sooo 'tacky' and also intermingles two distinct UI portions which reads of code-smell to me.
In iOS, I'd simply create a UITableView with two sections and each section would manage its own set of rows; the first section would manage the first list of data and the second the other. The UITableView would then just scroll them all together in one on-screen list which would work perfectly. But I don't know of anything similar in Android (although I'm admittedly new at it.)
So what is the proper 'Android' way(s) to do this?