Android - Multiple GridViews in a ListView

2019-08-14 10:51发布

问题:

I know that there are questions similar to this but I found no solution from it. What I'm trying to do is create a list of GridViews. Something like this:

What I currently have is this: item_cell.xml <-- layout for each item in the grid layout_grid.xml <-- layout of the grid list_view.xml <-- layout of the list which is then included to the layout of my Activity.

So what i was thinking was to inflate the item_cell to layout_grid.xml then inflate that after to list_view. Is this kind of idea possible? I havent tried it though because I'm not sure of how to approach it.

One thing, is there any library that could help this kind of approach?

Any idea is greatly appreciated.


As an additional question, my GridView is like a calendar but the days of the calendar are on the first column and the rest of the columns are somewhat like a schedule.

                  A        B       C      D
        Mon     data1    data2   data3
        Tues    data1    data2
        Wed     data1    data2
        Thurs
        Fri
        Sat
        Sun
        Mon
        .
        .
        .

Is there other way to implement this instead of putting it in an Array/List and calculate in which cell data should be added by just using an info from row and columns?

To illustrate: {Mon, data1, data2, data3, Tues, data1, data2, Wed. . . . . }

Again, i need englightenment. Your help is very much appreciated.

回答1:

For you first question, I think you're thinking of something like this: https://sriramramani.wordpress.com/2013/08/14/grid-in-a-listview/

For the second question, could you elaborate at all? Do the column headers for data elements need to be displayed?