Sections-decorator-android Introduction

Have you ever wanted to have a scrolling list with a section title visible all the time? Now you can do it in your own app. Just use our little library Sections-decorator!
It supports vertical and horizontal linear layout manager for Recyclerview and can be easily customized. You can change color and width of the line and TextView that shows your header.
How to use it?
-
Add jitpack.io to your `build.gradle` project repositories list:
repositories { maven { url 'https://jitpack.io' } }
-
Add library dependency to your app’s module build.gradle dependencies list:
implementation 'com.github.netguru:sections-decorator-android:0.1.1'
-
Implement the SectionsAdapterInterface interface in your RecyclerView’s adapter class that tells library how the sections are structured:
interface SectionsAdapterInterface { fun getSectionsCount() : Int fun getSectionTitleAt(sectionIndex: Int): String fun getItemCountForSection(sectionIndex: Int): Int }
The first method returns a number of sections available in adapter. The second one - what are titles for each section, and the last one - how many items are in each section.
-
Add a SectionDecorator to your recycler view.
SectionDecorator decorator = new SectionDecorator(getContext()); decorator.setLineColor(R.color.green) decorator.setLineWidth(15f) recyclerView.addItemDecoration(decorator);
Et voila:
Summary
The source code is available on Github: https://github.com/netguru/sections-decorator-android
How do you like it? Feel free to contribute to the project and contact us if you have any questions or feedback. We are happy to help and listen to your opinion!