ZPHRVItemDecoration
ItemDecoration for RecycleView with LinearLayoutManager or vertical GridLayoutmanager
Install / Use
/learn @zeropercenthappy/ZPHRVItemDecorationREADME
ZPHRVItemDecoration 简体中文
Divider
LinearLayoutManager
Usage
-
Full Wrap:
LinearLayoutManagerDivider divider = new LinearLayoutManagerDivider(color, dividerWidth); // if you have header view or footer view. // it will not influence layout, only use for calculate. divider.addHeaderView(headerView); divider.addFooterView(footerView); // rv.addItemDecoration(divider);
-
Not Full Wrap:
LinearLayoutManagerDivider divider = new LinearLayoutManagerDivider(color, dividerWidth, false); // if you have header view or footer view. // it will not influence layout, only use for calculate. divider.addHeaderView(headerView); divider.addFooterView(footerView); // rv.addItemDecoration(divider);
GridLayoutManager
Usage (Current version only support Vertical GridLayoutManager)
-
Full Wrap:
GridLayoutManagerDivider divider = new GridLayoutManagerDivider(color, dividerWidth, true); // if you want to set a different size of divider: GridLayoutManagerDivider divider = new GridLayoutManagerDivider(color, horizontalDividerHeight, horizontalDividerHeight, true); // if you have header view or footer view. // it will not influence layout, only use for calculate. divider.addHeaderView(headerView); divider.addFooterView(footerView); // rv.addItemDecoration(divider);
-
Not Full Wrap:
GridLayoutManagerDivider divider = new GridLayoutManagerDivider(color, dividerWidth, false); // if you want to set a different size of divider: GridLayoutManagerDivider divider = new GridLayoutManagerDivider(color, horizontalDividerHeight, verticalDividerWidth, false); // if you have header view or footer view. // it will not influence layout, only use for calculate. divider.addHeaderView(headerView); divider.addFooterView(footerView); // rv.addItemDecoration(divider);
Download
Step 1.
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Step 2.
Add the dependency in your module's build.gradle:
dependencies {
// For android compat version
implementation 'com.github.zeropercenthappy:ZPHRVItemDecoration:1.0.9'
// For androidX version
implementation 'com.github.zeropercenthappy:ZPHRVItemDecoration:1.1.0'
}
Change log
-
1.1.0
Migrate to AndroidX.
-
1.0.9
Support different size of horizontal and vertical divider for GridLayoutManager.
-
1.0.8
fix draw way of not full wrap style.
-
1.0.7
Use kotlin to rewrite, rewrite all calculate logic, support to set header view and footer view.
-
1.0.6
Downgrade minSdkVersion to 14
-
1.0.4
Add sources jar
-
1.0.3
Fix build error
-
1.0.2
Support RecycleView set padding now.
Related Skills
node-connect
351.4kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
110.7kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
351.4kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
351.4kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
