TabScrollAttacher

It is not a custom TabLayout or RecyclerView. It is just a helper library to attach to your RecyclerView with your TabLayout. If you don't want to go with sticky header RecyclerView or something like that, and also want to provide a good experience when your user is scrolling the content, this small library is for you.

artgif

How?

You fetch your product list and their categories. All you need to do is calcualate start index for all categories. Attacher will do the rest.

If your backend guy returns this json,

CategoryA -> 10 items (between 0..10)
CategoryB -> 20 items (between 10..30)
CategoryC -> 30 items (between 30..60)

Then your offset list will be,

//3 tabs and their offset indexes in total list.
val categoryIndexOffsetList = [0,10,30]

Then?

Then you attach.

TabScrollAttacher(tabLayout, recyclerView, categoryIndexOffsetList)

Where?

maven { url 'https://jitpack.io' }
dependencies {
  compile 'com.github.iammert:TabScrollAttacher:1.0.0'
}

When? ?

When you have LinearLayoutManager, GridLayoutManager in any orientation (horizontal or vertical) you can use this library.

GitHub