Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Divider only for specific ViewTypes #442

Closed
chrisonline opened this issue Sep 8, 2017 · 1 comment
Closed

Divider only for specific ViewTypes #442

chrisonline opened this issue Sep 8, 2017 · 1 comment
Milestone

Comments

@chrisonline
Copy link

I use the default divider and have section headers:

recyclerView.addItemDecoration(new FlexibleItemDecoration(activity).withDefaultDivider()
                .withOffset(10)
                .withBottomEdge(true)
                .withTopEdge(true)

But how can I draw the divider only on subitems and not the header item?
Any hints how I can do this? Or is there already a function inside the library to hide dividers on headers?

@davideas davideas added this to the 5.0.0-rc3 milestone Sep 10, 2017
@davideas davideas changed the title Divider only on SubItems Divider only for specific ViewTypes Sep 10, 2017
@davideas
Copy link
Owner

davideas commented Sep 10, 2017

You will be able to specify a list of the view types directly in the 2 methods for dividers:

mRecyclerView.addItemDecoration(new FlexibleItemDecoration(getActivity())
        .withDefaultDivider(
                R.layout.recycler_simple_item,
                R.layout.recycler_scrollable_expandable_item));

// OR only 1 view type.
mRecyclerView.addItemDecoration(new FlexibleItemDecoration(getActivity())
        .withDivider(R.drawable.divider, R.layout.recycler_simple_item));

// OR nothing as before (all views will have the divider)
mRecyclerView.addItemDecoration(new FlexibleItemDecoration(getActivity())
        .withDefaultDivider());

Note: From RC3, the view type, optionally, can be different from the layout resource id and can be customized by the developer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants