nontravis/recycler-view-margin-decoration
소개
RecyclerView의 각 항목에 여백을 추가하는 라이브러리입니다.
개발 도구측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
Original「 RecyclerView Margin Decoration 」

A library for add margin each item in RecyclerView.
「 New UPDATE 」
- version 1.2.1 - support RTL language
「 DEMO APPLICATION 」
「 Installation 」
Maven
<dependency>
<groupId>com.github.thekhaeng</groupId>
<artifactId>recycler-margin</artifactId>
<version>1.2.1</version>
<type>pom</type>
</dependency>
Gradle
compile ('com.github.thekhaeng:recycler-margin:1.2.1') {
exclude group: 'com.android.support', module: 'recyclerview-v7'
}
「 Usage 」
For LinearLayoutManager
recyclerView.addItemDecoration( new LayoutMarginDecoration( 1, spaceInPx ) );
For GridLayoutManager
recyclerView.addItemDecoration( new LayoutMarginDecoration( yourColumn, spaceInPx ) );
For StaggeredGridLayoutManager
recyclerView.addItemDecoration( new LayoutMarginDecoration( yourColumn, spaceInPx ) );
Set padding
LayoutMarginDecoration layoutMargin = new LayoutMarginDecoration( gridSpan, itemSpace );
layoutMargin.setPadding(recyclerView, top, bottom, left, right );
or
layoutMargin.setPadding(recyclerView, padding );
or use xml
<android.support.v7.widget.RecyclerView
...
android:padding="16dp"
android:clipToPadding="false"
android:scrollbarStyle="outsideOverlay"
...
/>
Click listener
LayoutMarginDecoration layoutMargin = new LayoutMarginDecoration( spaceInPx );
layoutMargin.setOnClickLayoutMarginDecorationItemListener( new OnClickLayoutMarginDecorationItemListener(){
@Override
public void onClick( Context context, View v, int position, int spanIndex, RecyclerView.State state ){
Toast.makeText( context, "item: " + position + "\ncolumn: " + spanIndex, Toast.LENGTH_SHORT ).show();
}
);
Licence
Copyright 2017 TheKhaeng
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with the License. You may obtain a copy of the License in the LICENSE file, or at:
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Developed By Thai android developer.

Follow facebook.com/thekhaeng.io on Facebook page. or @nonthawit at my Medium blog. :)
For contact, shoot me an email at [email protected]
관련 프로젝트 살펴보기
불러오는 중…