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

Divider drawn between items in StatelessSection #25

Closed Nutomic closed 7 years ago

Nutomic commented 7 years ago

I'm adding a seperator to my RecyclerView with this code:

DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(recyclerView.getContext(),
    layoutManager.getOrientation());
recyclerView.addItemDecoration(dividerItemDecoration);

However, the divider is also drawn between items in a section. You can see this in the screenshot (I changed the color to red for better visibility). Dividers should only be visible above "TechRabbit" and "Amazon.com". screenshot_20161223-102857

I'm happy to help with this, if you tell me how it can be fixed.

luizgrp commented 7 years ago

Unfortunately this is how RecyclerView works, this library it's only a custom adapter not a custom RecyclerView.

If you don't want the lines for every item, don't use ItemDecoration and add the line in your header layout as in many examples of the demo app, for instance, check the header layout of Example1.