All Projects → ibosong → Commonitemdecoration

ibosong / Commonitemdecoration

Licence: apache-2.0
A custom ItemDecoration which appends dividers(with same thickness) between items(with same dimension) for RecyclerView

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Commonitemdecoration

Recyclerviewtest
RecyclerView 实践学习的demo,其中有基本的列表,表格,瀑布流,进阶的,等等
Stars: ✭ 23 (-43.9%)
Mutual labels:  recyclerview
Observableadapter
RecyclerView Adapter for RxJava, separates collection model from Android framework dependencies
Stars: ✭ 15 (-63.41%)
Mutual labels:  recyclerview
Autoplayvideos
Android library to auto-play/pause videos from url in recyclerview.
Stars: ✭ 981 (+2292.68%)
Mutual labels:  recyclerview
Slimadapter
A slim & clean & typeable Adapter without# VIEWHOLDER
Stars: ✭ 939 (+2190.24%)
Mutual labels:  recyclerview
Multilinedivider
Multi divider in RecyclerView on Android.
Stars: ✭ 13 (-68.29%)
Mutual labels:  recyclerview
Turn Layout Manager
A carousel layout manager for RecyclerView
Stars: ✭ 946 (+2207.32%)
Mutual labels:  recyclerview
Base Mvvm
App built to showcase basic Android View components like ViewPager, RecyclerView(homogeneous and heterogeneous items), NavigationDrawer, Animated Vector Drawables, Collapsing Toolbar Layout etc. housed in a MVVM architecture
Stars: ✭ 18 (-56.1%)
Mutual labels:  recyclerview
Retrofit Recyclervew
An implementation of a RecyclerView using Retrofit and Glide to create a movie list
Stars: ✭ 40 (-2.44%)
Mutual labels:  recyclerview
Candyview
Implement any RecyclerView in just 1 Line. CandyView handles everything for you.
Stars: ✭ 15 (-63.41%)
Mutual labels:  recyclerview
Focusresize
A custom animation with scroll listener to recycler views
Stars: ✭ 971 (+2268.29%)
Mutual labels:  recyclerview
Mapme
The Android maps adapter
Stars: ✭ 844 (+1958.54%)
Mutual labels:  recyclerview
Featuredrecyclerview
Ultimate recycler view.
Stars: ✭ 872 (+2026.83%)
Mutual labels:  recyclerview
Simplerecyclerview
A RecyclerView extension for building list more easily.
Stars: ✭ 953 (+2224.39%)
Mutual labels:  recyclerview
Celladapter
CellAdapter simplifies working with RecyclerView. It provides an opportunity to easily support multiple view types, to separate ViewHolders from Adapter class, map data to a view in a convenient way, register and handle UI callbacks for each ViewHolder.
Stars: ✭ 24 (-41.46%)
Mutual labels:  recyclerview
Google Books Android Viewer
Android library to bridge between RecyclerView and sources like web page or database. Includes demonstrator (Google Books viewer)
Stars: ✭ 37 (-9.76%)
Mutual labels:  recyclerview
Sectionpicker
A Custom Android view for fast scroll with sections in lists
Stars: ✭ 22 (-46.34%)
Mutual labels:  recyclerview
Recyclerviewdemo
Android L 新增UI控件:RecyclerView CardView的简单使用
Stars: ✭ 15 (-63.41%)
Mutual labels:  recyclerview
Grouprecyclerviewadapter
可增删改查、可动画展开收起、可吸附悬浮动态可配置的分组列表
Stars: ✭ 41 (+0%)
Mutual labels:  recyclerview
Flagchatadapter
FlagChatAdapter is easy to implement enchanting recycler view adapter. Just extend your adapter with FlagChatAdapter, impliment some methods and voila! You have got the most beautiful looking chat on your phone. Zero boilerplate code, just put your variables in the right direction.
Stars: ✭ 39 (-4.88%)
Mutual labels:  recyclerview
Pager Layoutmanager
[暂停维护]Android 网格分页布局。
Stars: ✭ 956 (+2231.71%)
Mutual labels:  recyclerview

A custom ItemDecoration which appends dividers(with same thickness) between items(with same dimension) for RecyclerView

中文版

When using RecyclerView, we often need set dividers between items. Usually, we set right_margin to the root layout of each item. In this way, you hava to set a left_margin to the RecyclerView to make the list looks symmetric. There's another way to do this. We can customize ItemDecoration and override the getItemOffsets method. Also, set right to the parameter outRect to each item. And add left to the first item. In this way, you will find that the width between the first and other items are not the same.

So this SCommonItemDecoration is the best way. It supports LinearLayoutManager, GridLayoutManager and StaggeredGridLayoutManager, also supports different orientation.

Usage

You need first initailize a SparseArray of SCommonItemDecoration.ItemDecorationProps which contains properties for different type of items.

SparseArray<SCommonItemDecoration.ItemDecorationProps> propMap = new SparseArray<>();

SCommonItemDecoration.ItemDecorationProps inculdes these fields:

private int verticalSpace; 
private int horizontalSpace; 
private boolean hasVerticalEdge; 
private boolean hasHorizontalEdge;

After set these fields of ItemDecorationProps, new a SCommonItemDecoration and set it to the RecyclerView:

mBrandRecyclerView.addItemDecoration(new SCommonItemDecoration(propMap));

That's all, enjoy youself.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].