Giter Site home page Giter Site logo

divider's Introduction

Divider

RecyclerView通用分割线,ItemDecoration for Recyclerview

适配了LinearLayoutManager、GridLayoutManager、StaggeredGridLayoutManager

使用说明:

Demo

下载 APK-Demo

效果:

原始用法 增头增尾

导入

Android studio

implementation 'com.ray:divider:0.0.1'

若出现依赖包版本冲突请使用以下依赖方式:

compile('com.ray:divider:0.0.1', {exclude group: 'com.android.support'})

调用:

recyclerView.addItemDecoration(Divider.builder()
        .color(Color.BLUE)
        .width(10)
        .height(20)
        .build());

介绍:

recyclerView.addItemDecoration(Divider.builder()
        .color(Color.BLUE)// 设颜色
        .width(10)// 设线宽px,用于画垂直线
        .height(20)// 设线高px,用于画水平线
        .headerCount(1)// 设头的数量
        .footerCount(1)// 设尾的数量
        .build());

// 如果以上属性发生变化,则调用下面对应方法修改

divider.setLineColor(Color.RED);
divider.setLineWidth(30);
divider.setLineHeight(30);
divider.setHeaderCount(2);
divider.setFooterCount(2);

注意事项:

1.如果增删不是调用的 adapter.notifyDataSetChanged() 则需要调用下面方法重新绘制线
recyclerView.invalidateItemDecorations();

divider's People

Contributors

ray512512 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.