An adapter to create Android RecyclerViews with sections, providing headers and footers.
An adapter to create Android RecyclerViews with sections, providing headers and footers.
⚠ This library is no longer maintained ⚠️
An adapter to create Android RecyclerViews with sections, providing headers and footers.
In order to use this library, you need to extend SectionedRecyclerView where:
H is a class extending RecyclerView.ViewHolder to hold the view for section headers.VH is a class extending RecyclerView.ViewHolder to hold the view for the regular items in the view.F is a class extending RecyclerView.ViewHolder to hold the view for section footers.According to the sample published in this repository:
SectionedRecyclerView:public class CountSectionAdapter extends SectionedRecyclerViewAdapter…GridLayoutManager, you need to set it a SectionedSpanSizeLookup to make sure that headers and footers span the whole width of the RecyclerView:GridLayoutManager layoutManager = new GridLayoutManager(this, 2);
SectionedSpanSizeLookup lookup = new SectionedSpanSizeLookup(adapter, layoutManager);
layoutManager.setSpanSizeLookup(lookup);
recycler.setLayoutManager(layoutManager);
Most times you will need a simpler version of this adapter, where there are no footers and your headers will only be a title. For those cases, you have SimpleSectionedAdapter, where VH is a class extending ViewHolder to hold the view of the regular items in your RecyclerView.
In this case, you will have to implement the following methods:
…Your result will look like this:

SectionedRecyclerView is available through JCenter. To be able to use this library in your project, add the following dependency to your build.gradle file:
dependencies{
compile 'com.truizlop.sectionedrecyclerview:library:1.2.0'
}Copyright 2015 Tomás Ruiz-López
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.No open issues yet, or sync has not completed.