All Projects → yanyusong → Y_divideritemdecoration

yanyusong / Y_divideritemdecoration

Licence: apache-2.0
A common RecyclerView divider , supports the LinearLayoutManager and the GridLayoutManager.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Y divideritemdecoration

Android Gif Example
Gif RecyclerView in MVP using Dagger 2 + Retrofit 2 + Moshi + RxJava 2 + Glide 4 with JUnit and Espresso tests written in Kotlin + Kotlin DSL!
Stars: ✭ 334 (-10.46%)
Mutual labels:  recyclerview
Recyclerstickyheaderview
Sticky header view or suspending view for RecyclerView.
Stars: ✭ 347 (-6.97%)
Mutual labels:  recyclerview
Imageviewer
🔮图片浏览器,支持图片手势缩放、拖拽等操作,`自定义View`的模式显示,自定义图片加载方式,更加灵活,易于扩展,同时也适用于RecyclerView、ListView的横向和纵向列表模式,最低支持版本为Android 3.0及以上...
Stars: ✭ 363 (-2.68%)
Mutual labels:  recyclerview
Horizontalpicker
A simple, customizable and easy to use picker where centre view is scaled up
Stars: ✭ 337 (-9.65%)
Mutual labels:  recyclerview
Giraffeplayer2
out of the box android video player(support lazy load, ListView/RecyclerView and hight performance)
Stars: ✭ 344 (-7.77%)
Mutual labels:  recyclerview
Recyclerviewitemdecorations
ItemDecoration for Android Recyclerview
Stars: ✭ 351 (-5.9%)
Mutual labels:  recyclerview
Androidfastscroll
Fast scroll for Android RecyclerView and more
Stars: ✭ 316 (-15.28%)
Mutual labels:  recyclerview
Familiarrecyclerview
一个如你熟悉ListView、GridView一样熟悉的RecyclerView
Stars: ✭ 372 (-0.27%)
Mutual labels:  recyclerview
Recyclerlistview
High performance listview for React Native and web!
Stars: ✭ 4,033 (+981.23%)
Mutual labels:  recyclerview
Multichoicerecyclerview
Multi choice selection applied on recycler view make life easier
Stars: ✭ 361 (-3.22%)
Mutual labels:  recyclerview
Recycler View Divider
A library which configures a divider for a RecyclerView.
Stars: ✭ 338 (-9.38%)
Mutual labels:  recyclerview
Stacklayoutmanager
customized layoutmanager,let item pile up like stackview/类似最美有物卡片堆叠效果
Stars: ✭ 343 (-8.04%)
Mutual labels:  recyclerview
Androidproject
Android 技术中台,但愿人长久,搬砖不再有
Stars: ✭ 4,398 (+1079.09%)
Mutual labels:  recyclerview
Flexibleadapter
Fast and versatile Adapter for RecyclerView which regroups several features into one library to considerably improve the user experience :-)
Stars: ✭ 3,482 (+833.51%)
Mutual labels:  recyclerview
Android Extensions
An Android library with modules to quickly bootstrap an Android application.
Stars: ✭ 356 (-4.56%)
Mutual labels:  recyclerview
Fastadapter
The bullet proof, fast and easy to use adapter library, which minimizes developing time to a fraction...
Stars: ✭ 3,512 (+841.55%)
Mutual labels:  recyclerview
Brv
Android上最强大的RecyclerView库
Stars: ✭ 345 (-7.51%)
Mutual labels:  recyclerview
Klaster
Declare RecyclerView adapters in a functional way, without boilerplate and subclassing. No compromises on flexibility. If it's possible to do something by subclassing, it's possible to do it with this library.
Stars: ✭ 373 (+0%)
Mutual labels:  recyclerview
Dragselectrecyclerview
TouchListener that can be attached to any RecyclerView and handles multi selection for you
Stars: ✭ 371 (-0.54%)
Mutual labels:  recyclerview
Corbind
Kotlin Coroutines binding APIs for Android UI widgets from the platform and support libraries
Stars: ✭ 357 (-4.29%)
Mutual labels:  recyclerview

Y_DividerItemDecoration

一个通用的RecyclerView的分割线,支持LinearLayoutManager和GridLayoutManager。只要你能描述清楚每个position上下左右分割线的情况,原则上支持任意LayoutManager

图1 LinearLayoutManager 图2 大分割线GridViewLayoutManager 图2 普通GridViewLayoutManager 图3 异型GridViewLayoutManager

Features

  • LinearLayoutManager和GridViewLayoutManager通用
  • 以每个item的上、下、左、右每条边为控制单位
  • 可以单独控制每边是否显示
  • 可以单独控制每边的颜色
  • 可以单独控制每边的宽度
  • 可以单独控制每边的 startPadding 和 endPadding

Usage

Step 1

将依赖加入你项目的build.gradle中:

compile 'com.yanyusong.y_divideritemdecoration:y_divideritemdecoration:2.0'

Step 2

新建一个对象实现抽象类 Y_DividerItemDecoration ,在 getDivider(int itemPosition) 中定义在itemPosition时条目的分割线情况,有无、颜色、宽度、startpadding 和 endpadding 。

    private class DividerItemDecoration extends Y_DividerItemDecoration {

        private DividerItemDecoration(Context context) {
            super(context);
        }

        @Override
        public Y_Divider getDivider(int itemPosition) {
            Y_Divider divider = null;
            switch (itemPosition % 2) {
                case 0:
                    //每一行第一个显示rignt和bottom
                    divider = new Y_DividerBuilder()
                            .setRightSideLine(true, 0xff666666, 10, 0, 0)
                            .setBottomSideLine(true, 0xff666666, 20, 0, 0)
                            .create();
                    break;
                case 1:
                    //第二个显示Left和bottom
                    divider = new Y_DividerBuilder()
                            .setLeftSideLine(true, 0xff666666, 10, 0, 0)
                            .setBottomSideLine(true, 0xff666666, 20, 0, 0)
                            .create();
                    break;
                default:
                    break;
            }
            return divider;
        }
    }

Step 3

给RecyclerView添加刚才实现的ItemDecoration

 recyclerView.addItemDecoration(new DividerItemDecoration(this));

License

   Copyright  2017  yanyusong
   
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License 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.
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].