luizgrp / SectionedRecyclerViewAdapter

An Adapter that allows a RecyclerView to be split into Sections with headers and/or footers. Each Section can have its state controlled individually.
MIT License
1.68k stars 372 forks source link

how to manage empty span in GridLayoutManager #79

Closed ZeroCool00 closed 6 years ago

ZeroCool00 commented 7 years ago

First of all thank you for this beautiful library.

section header is set as item if span is empty in GridLayoutManager, how do i solve this:

full description is here: https://stackoverflow.com/questions/45931337/how-to-manage-empty-span-in-gridlayoutmanager

dimaselpiojo commented 7 years ago

My problem is the same. when i change spanCount 3 GridLayoutManager glm = new GridLayoutManager(getContext(), 3); It's not working as I expected.

ZeroCool00 commented 7 years ago

i'll add bounty tomorrow.. keep looking to my question, hope you can solve it too.

AshishPsaini commented 6 years ago

getting same issue

AshishPsaini commented 6 years ago

GridLayoutManager glm = new GridLayoutManager(getContext(),3); glm.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() { @Override public int getSpanSize(int position) { switch(sectionAdapter.getSectionItemViewType(position)) { case SectionedRecyclerViewAdapter.VIEW_TYPE_HEADER: return 3; default: return 1; } } }); this is working fine.

luizgrp commented 6 years ago

I replied to your stackoverflow thread, it seems to be working fine.

if anyone else is still having problems related to this please reply there sharing your code or open another question with the tag sectionedrecyclerviewadapter