2.10.1 (May 3, 2022)
Sep 1, 2016
Oct 3, 2023
Lisa Wray (lisawray)
Vivek Kiran Ballakur (vivekkiran)
Simon Marquis (SimonMarquis)
Riccardo Ciovati (rciovati)
鲁大师 (donglua)
Jc Miñarro (JcMinarro)
Nimrod Dayan (Nimrodda)
Mike Nakhimovich (digitalbuddha)
Sato Shun (satoshun)
Vadim Kotov (vkotovv)
Lisa Wray (lisawray)
Mohit (msya)
Zsolt Világos (zsoltvilagos)
Jumpei Matsuda (jmatsu)
Paul Woitaschek (PaulWoitaschek)
Tyler McCraw (TylerMcCraw)
Aidan Pieper (Plastix)
Gabor Varadi (Zhuinden)
Show all (45)45
Source code


Groupie is a simple, flexible library for complex RecyclerView layouts.

Groupie lets you treat your content as logical groups and handles change notifications for you -- think sections with headers and footers, expandable groups, blocks of vertical columns, and much more. It makes it easy to handle asynchronous content updates and insertions and user-driven content changes. At the item level, it abstracts the boilerplate of item view types, item layouts, viewholders, and span sizes.

Try it out:

implementation "com.github.lisawray.groupie:groupie:$groupie_version"

Groupie also has a support module for Android's view binding. This module also supports Android data binding, so if your project uses both data binding and view binding, you don't have to add the dependency on the data binding support module. Setup here.

implementation "com.github.lisawray.groupie:groupie:$groupie_version"
implementation "com.github.lisawray.groupie:groupie-viewbinding:$groupie_version" 


If using groupie-viewbinding in a databinding project is only available when using Android Gradle Plugin 3.6.0 or higher.

If using an older Gradle Plugin version with databinding the you can use the standalone groupie-databinding library to generate view holders. Setup here.

implementation "com.github.lisawray.groupie:groupie:$groupie_version"
implementation "com.github.lisawray.groupie:groupie-databinding:$groupie_version" 

You can also use Groupie with Java and your existing ViewHolders.

Which one to choose? It's up to you and what your project already uses. You can even use Kotlin and data binding together.* Or all your existing hand-written Java ViewHolders, and one new Kotlin item to try it out. Go crazy!

Get started

Use a GroupieAdapter anywhere you would normally use a RecyclerView.Adapter, and attach it to your RecyclerView as usual.


val adapter = GroupieAdapter()
recyclerView.adapter = adapter


GroupieAdapter adapter = new GroupieAdapter();


Groups are the building block of Groupie. An individual Item (the unit which an adapter inflates and recycles) is a Group of 1. You can add Groups and Items interchangeably to the adapter.


groupAdapter += HeaderItem()
groupAdapter += CommentItem()

val section = Section()
groupAdapter += section


groupAdapter.add(new HeaderItem());
groupAdapter.add(new CommentItem());

Section section = new Section();
section.setHeader(new HeaderItem());

Modifying the contents of the GroupieAdapter in any way automatically sends change notifications. Adding an item calls notifyItemAdded(); adding a group calls notifyItemRangeAdded(), etc.

Modifying the contents of a Group automatically notifies its parent. When notifications reach the GroupieAdapter, it dispatches final change notifications. There's never a need to manually notify or keep track of indices, no matter how you structure your data.

section.removeHeader(); // results in a remove event for 1 item in the adapter, at position 2

There are a few simple implementations of Groups within the library:

  • Section, a list of body content with an optional header group and footer group. It supports diffing and animating moves, updates and other changes
  • ExpandableGroup, a single parent group with a list of body content that can be toggled hidden or shown.

Groupie tries not to assume what features your groups require. Instead, groups are flexible and composable. They can be combined and nested to arbitrary depth.

Life (and mobile design) is complicated, so groups are designed so that making new ones and defining their behavior is easy. You should make many small, simple, custom groups as the need strikes you.

You can implement the Group interface directly if you want. However, in most cases, you can extend Section or the base implementation, NestedGroup. Section supports common RV paradigms like diffing, headers, footers, and placeholders. NestedGroup provides support for arbitrary nesting of groups, registering/unregistering listeners, and fine-grained change notifications to support animations and updating the adapter.


Groupie abstracts away the complexity of multiple item view types. Each Item declares a view layout id, and gets a callback to bind the inflated layout. That's all you need; you can add your new item directly to a GroupieAdapter and call it a day.

Item with data binding:

The Item class gives you simple callbacks to bind your model object to the generated binding. Because of data binding, there's no need to write a view holder.

public class SongItem extends BindableItem<SongBinding> {

    public SongItem(Song song) {

    @Override public void bind(SongBinding binding, int position) {

    @Override public int getLayout() {

If you're converting existing ViewHolders, you can reference any named views (e.g. directly from the binding instead.

    @Override public void bind(SongBinding binding, int position) {

You can also mix and match BindableItem and other Items in the adapter, so you can leave legacy viewholders as they are by making an Item<MyExistingViewHolder>.

Legacy item (your own ViewHolder)

You can leave legacy viewholders as they are by converting MyExistingViewHolder to extend GroupieViewHolder rather than RecyclerView.ViewHolder. Make sure to change the imports to com.xwray.groupie.Item and com.xwray.groupie.GroupieViewHolder.

Finally, in your Item<MyExistingViewHolder>, override

    public MyExistingViewHolder createViewHolder(@NonNull View itemView) {
        return new MyExistingViewHolder(itemView);


Items can also declare their own column span and whether they are draggable or swipeable.

Gradle setup


In your project level build.gradle file, include:

buildscript {
    ext.kotlin_version = '1.6.21'

    repositories {

    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

allprojects {
    repositories {
        maven { url "" }

In new projects, the settings.gradle file has a dependencyResolutionManagement block, which needs to specify the repository as well:

dependencyResolutionManagement {
    repositories {
        maven { url '' }  // <--
        jcenter() // Warning: this repository is going to shut down soon

In your app build.gradle file, include:

implementation 'com.github.lisawray.groupie:groupie:$groupie_version'

View binding

Add to your app module's build.gradle:

android {
    buildFeatures {
        viewBinding true

dependencies {
    implementation "com.github.lisawray.groupie:groupie:$groupie_version"
    implementation "com.github.lisawray.groupie:groupie-viewbinding:$groupie_version"


class MyLayoutItem: BindableItem<MyLayoutBinding>() {
    override fun initializeViewBinding(view: View): MyLayoutBinding {
        return MyLayoutBinding.bind(view)

    // Other implementations...


If you use groupie-databinding with data binding classes and your layouts have some variables or observable objects, don't forget to run executePendingBindings at the last point in bind.

Data binding

Add to your app module's build.gradle:

android {
    buildFeatures {
        dataBinding true

dependencies {
    implementation "com.github.lisawray.groupie:groupie:$groupie_version"
    implementation "com.github.lisawray.groupie:groupie-databinding:$groupie_version"

Then, just wrap each item layout in <layout> tags. (The <data> section is optional.)


<layout xmlns:android="" 
        <variable name="song" type="com.example.Song" />

        android:layout_height="wrap_content" >

            tools:text="A Song Title" />


Bindings are only generated for layouts wrapped with tags, so there's no need to convert the rest of your project (unless you want to).

You can add a <data> section to directly bind a model or ViewModel, but you don't have to. The generated view bindings alone are a huge time saver.

Kotlin AND data binding / view binding?

Sure, why not? Follow all the instructions from both sections above. You only need to include the groupie-databinding or groupie-viewbinding dependency.


Contributions you say? Yes please!

Bug report?

  • If at all possible, please attach a minimal sample project or code which reproduces the bug.
  • Screenshots are also a huge help if the problem is visual.

Send a pull request!

  • If you're fixing a bug, please add a failing test or code that can reproduce the issue.

If you try it out, I'd love to know what you think. Please hit up Lisa at [first][last] or on Twitter at @lisawrayz.