Setting divider for RecyclerView.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
gradle/wrapper
img
library
sample
.gitignore
README.md
build.gradle
gradle.properties
gradlew
gradlew.bat
settings.gradle

README.md

RecyclerViewDivider

Setting divider for RecyclerView.

Usage

  1. Add the dependencies to your build.gradle file, RecyclerViewDivider is avaiable in JCenter:

    compile 'com.jaeger.recyclerviewdivider:library:1.0.1'
    
  2. Use RecyclerViewDivider.Builder

    RecyclerViewDivider divider = new RecyclerViewDivider.Builder(this)
        .setStyle(RecyclerViewDivider.Style.BETWEEN)
        .setDrawableRes(R.drawable.divider)
        .setMarginLeft(72)
        .setMarginRight(8)
        .build();
    mRvList.addItemDecoration(divider);

Feature

  1. Style

    • START
    • END
    • BETWEEN
    • BOTH

  2. Set margin

     RecyclerViewDivider divider = new RecyclerViewDivider.Builder(this)
                .setOrientation(RecyclerViewDivider.VERTICAL)
                .setStyle(RecyclerViewDivider.Style.BETWEEN)
                .setColorRes(R.color.divider_gray)
                .setSize(1.5f)
                .setMarginLeft(72)
                .setMarginRight(8)
                .build();

  3. Set drawable

    RecyclerViewDivider divider = new RecyclerViewDivider.Builder(this)
        .setStyle(RecyclerViewDivider.Style.BETWEEN)
        .setDrawableRes(R.drawable.divider)
        .setMarginLeft(72)
        .setMarginRight(8)
        .build();
    mRvList.addItemDecoration(divider);

  4. Set skip count

    RecyclerViewDivider divider = new RecyclerViewDivider.Builder(this)
        .setOrientation(RecyclerViewDivider.VERTICAL)
        .setStyle(RecyclerViewDivider.Style.BETWEEN)
        .setColorRes(R.color.divider_gray)
        .setSize(1.5f)
        .setStartSkipCount(2)
        .setMarginLeft(72)
        .setMarginRight(8)
        .build();