GridView with section headers
Asked Answered
A

2

3

Im trying to implement a GridView with section headers. I found one other question here Android GridView with categories? , however following the accepted answer gives me "header" as cells instead of the header being in its own row.

Im not sure what Im missing here (have tried the MergeAdapter too), can someone point out the nuance thats needed to implement the section headers in a GridView ?

Avalokitesvara answered 2/11, 2012 at 21:58 Comment(0)
E
6

This is not strictly possible. GridView does everything in terms of cells.

Now, you are welcome to create a set of cells that, when displayed together in a row, happen to look like a header. Presumably my MergeAdapter can handle that, though I have certainly never tried it. It will be up to you to ensure that:

  • the header cells are all in one row, which implies that...
  • empty cells go in any spaces in the preceding row, after the last "real" cell and before your header cells, and...
  • that you have the right number of header cells (i.e., equal to your number of columns), and...
  • that the header cells render correctly to look like a contiguous header, and...
  • that you use areAllItemsEnabled() and isEnabled() correctly, so that the header cells and the empty cells are not enabled
Exquisite answered 2/11, 2012 at 22:31 Comment(2)
It seems that StickyGridHeaders managed to create a header row that doesn't look like merged cells.Expatiate
@AlikElzin-kilaka: Their headers are not cells at all, AFAICT, but rather are other views layered atop a GridView.Exquisite
O
0

Try modifying the usual listview adapter to return grid cells see here

Ostracize answered 19/9, 2015 at 14:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.