Skip to content

GridLayoutManager usage #7

@IamEgor

Description

@IamEgor

Greetings!

I'm trying to use this lib with GridLayoutManager.
But when I've done this, the result was not as I expected.

device-2016-02-25-015937
device-2016-02-25-020010
device-2016-02-25-020050

When all tabs are expanded thats fine. In other cases it's looked wired.
I use this code in my Activity.

final GridLayoutManager manager = new GridLayoutManager(this, 2);
        recycler.setLayoutManager(manager);

        final PeopleAdapter adapter = new PeopleAdapter(this);
        recycler.setAdapter(adapter);

        manager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
            @Override
            public int getSpanSize(int position) {
                return adapter.isHeader(position) ? manager.getSpanCount() : 1;
            }
        });

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions