Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
S

SectionedRecyclerView

> 编程语言
Open source

An adapter to create Android RecyclerViews with sections, providing headers and footers.

796 stars0 likes0 views
WebsiteGitHub

About

An adapter to create Android RecyclerViews with sections, providing headers and footers.

⚠ This library is no longer maintained ⚠️

SectionedRecyclerView

An adapter to create Android RecyclerViews with sections, providing headers and footers.

Usage

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:

    1. Create a class extending SectionedRecyclerView:
java
public class CountSectionAdapter extends SectionedRecyclerViewAdapter
    1. Implement the corresponding methods:
…
    1. If you use a GridLayoutManager, you need to set it a SectionedSpanSizeLookup to make sure that headers and footers span the whole width of the RecyclerView:
java
GridLayoutManager layoutManager = new GridLayoutManager(this, 2);
SectionedSpanSizeLookup lookup = new SectionedSpanSizeLookup(adapter, layoutManager);
layoutManager.setSpanSizeLookup(lookup);
recycler.setLayoutManager(layoutManager);
    1. Your result will look like this:

SectionedRecyclerView screenshot

Even simpler

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:

SimpleSectionedAdapter screenshot

Get it!

SectionedRecyclerView is available through JCenter. To be able to use this library in your project, add the following dependency to your build.gradle file:

groovy
dependencies{
	compile 'com.truizlop.sectionedrecyclerview:library:1.2.0'
}

License

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.

Issues· 19 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Java

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言