Open adrien-aubel opened 8 years ago
Could you please elaborate a little further on why you need this? If you don't want a header for a section, then don't group those things into different sections. For instance, if you want 2 sections with 3 elements each, but don't want header in the second section, then either hide such header or make a single section with 6 elements. The requirement that you are requesting can be implemented with the current state of the library.
I want to know how you can remove header for the first section.
You could just set its visibility to GONE
@truizlop Thanks. got it working. Could you please help me with another. I cannot add different item layouts based on the viewType in the onCreateItemViewHolder. This method will only have one viewType. Is there any way to get a different viewType ?
You have to override getSectionItemViewType(int section, int position)
and return a different integer number for each viewType
that you have. Make sure you don't use the same viewTypes the library is using to distinguish between headers and footers (namely -1, -2, -3; thus, using positive ints is safe).
Then, when you implement onCreateItemViewHolder(ViewGroup parent, int viewType)
you will receive those viewTypes and you will have to decide which layout to inflate.
@truizlop Thankyou so much.That worked
@truizlop Facing the same issue. Even though I'm setting the header's visibility to View.GONE, the item decoration adding vertical spacing is effective. So, instead of header, I get double vertical spacing on top. I think hasHeaderInSection would be clean way to fix this.
Hi there,
It would be awesome if you could add a
protected boolean hasHeaderInSection(int section)
(defaulttrue
for convenience and retro-compatibility).There are 2 small usages of the
hasFooterInSection
method so this change should be relatively lightweight.That would help us use your library without tricks with a RecyclerView having
app:stackFromEnd
set totrue
(drawing from the bottom to the top).That would also help some users to use this library for separators, if they want to not show the first header for example.