Giter VIP home page Giter VIP logo

commonrecyclerview's Introduction

CommonRecyclerView

Gradle

compile 'cn.ittiger:recyclerview:1.6'

封装了RecyclerView为RecyclerView增加了如下4个常用功能:

1.设置RecyclerView中每项的点击事件

mAdapter.setOnItemClickListener(new CommonRecyclerViewAdapter.OnItemClickListener());

2.设置RecyclerView中每项的长按点击事件

mAdapter.setOnItemLongClickListener(new CommonRecyclerViewAdapter.OnItemLongClickListener());

3.列表滑动到底部自动加载更多

mRecyclerView.setOnLoadMoreListener(new CommonRecyclerView.LoadMoreListener()); 如果不想开启滑动到底部自动加载更多这个功能,则可以不设置加载更多监听, 也可以通过mRecyclerView.setEnableAutoLoadMore(false)关闭此功能

4.与ListView一样支持设置EmptyView

mRecyclerView.setEmptyView(View view);

封装RecyclerView.Adapter使其更通用

1.可以添加任意视图作为HeaderView

通过CommonRecyclerViewAdapter实例调用addHeaderView方法可以添加多个HeaderView,但是HeaderView的显示默认是关闭的, 添加之前需要先通过mAdapter.enableHeaderView()方法时RecyclerView中的HeaderView功能可用

2.可以添加任意视图作为FooterView

通过CommonRecyclerViewAdapter实例调用addFooterView方法可以添加多个FooterView,但是FooterView的显示默认是关闭的, 添加之前需要先通过mAdapter.enableFooterView()方法时RecyclerView中的FooterView功能可用

3.更新mAdapter时,RecyclerView刷新采用局部刷新

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.