All Ruby on Rails Node JS Android iOS React Native Frontend

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?

  1. Add jitpack.io to your `build.gradle` project repositories list:

    repositories {
       maven { url 'https://jitpack.io' }
    }
  2. Add library dependency to your app’s module build.gradle dependencies list:

    implementation 'com.github.netguru:sections-decorator-android:0.1.1'
  3. 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.

  4. 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!

 

Photo by Susan Yin on Unsplash

Let's make the world better for everyone - join us
New Call-to-action
READ ALSO FROM library
Read also
Need a successful project?
Estimate project or contact us