Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/laobie/RecyclerViewDivider
Setting divider for RecyclerView.
https://github.com/laobie/RecyclerViewDivider
Last synced: 3 months ago
JSON representation
Setting divider for RecyclerView.
- Host: GitHub
- URL: https://github.com/laobie/RecyclerViewDivider
- Owner: laobie
- Created: 2016-12-30T13:15:51.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-01-04T14:29:26.000Z (almost 8 years ago)
- Last Synced: 2024-06-16T03:31:37.578Z (5 months ago)
- Language: Java
- Homepage:
- Size: 1.05 MB
- Stars: 68
- Watchers: 5
- Forks: 12
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-github-android-ui - RecyclerViewDivider - 为RecyclerView设置分频器 (RecyclerView)
README
## RecyclerViewDivider
Setting divider for RecyclerView.
![](img/logo.png)
### Usage
1. Add the dependencies to your build.gradle file, RecyclerViewDivider is avaiable in JCenter:
```groovy
compile 'com.jaeger.recyclerviewdivider:library:1.0.1'```
2. Use `RecyclerViewDivider.Builder`
```java
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![](img/style.jpg)
2. Set margin
```java
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();
```![](img/set_margin.png)
3. Set drawable
```java
RecyclerViewDivider divider = new RecyclerViewDivider.Builder(this)
.setStyle(RecyclerViewDivider.Style.BETWEEN)
.setDrawableRes(R.drawable.divider)
.setMarginLeft(72)
.setMarginRight(8)
.build();
mRvList.addItemDecoration(divider);
```![](img/set_drawable.png)
4. Set skip count
```java
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();
```![](img/set_skip.png)