XAdapter 一个支持 add 多个 header 和 footer,并且支持下拉刷新上拉加载的 recyclerViewAdapter
2017-04-09 13:13
513 查看
XAdapter
项目地址:7449/XAdapter![](https://oscdn.geek-share.com/Uploads/Images/Content/201606/7d0234f6040bfebfea82f8d6092495f1.png)
简介:XAdapter 一个支持 add 多个 header 和 footer,并且支持下拉刷新上拉加载的 recyclerViewAdapterSupport for the pull-down refresh loading and the addition of multiple header and footer RecyclerViewAdapterBlog:https://7449.github.io/Android_XAdapter/
Screenshots
![](https://raw.githubusercontent.com/7449/XAdapter/master/xadapter.gif)
https://raw.githubusercontent.com/7449/XAdapter/master/xadapter.gif中文文档
gradle
compile 'com.xadapter:xadapter:0.1.7'Dividing line
Built a simple exampleXDividerItemDecoration
tips
It should be noted that, initXData () is not mandatory, only when the beginning of the RecyclerView need to have a data List must call initXData ()Full example
recyclerView.setAdapter( xRecyclerViewAdapter .initXData(mainBeen) .addRecyclerView(recyclerView) .setLayoutId(R.layout.item) .setRefreshProgressStyle(ProgressStyle.BallSpinFadeLoader) .setLoadingMoreProgressStyle(ProgressStyle.BallRotate) .setImageView(R.drawable.iconfont_downgrey) .setHeaderBackgroundColor(R.color.colorBlack) .setFooterBackgroundColor(R.color.colorBlack) .setHeaderTextColor(R.color.textColor) .setFooterTextColor(R.color.textColor) .setPullRefreshEnabled(true) .setLoadingMoreEnabled(true) .addHeaderView(LayoutInflater.from(this).inflate(R.layout.item_header_1, (ViewGroup) findViewById(android.R.id.content), false)) .addHeaderView(LayoutInflater.from(this).inflate(R.layout.item_header_2, (ViewGroup) findViewById(android.R.id.content), false)) .addHeaderView(LayoutInflater.from(this).inflate(R.layout.item_header_3, (ViewGroup) findViewById(android.R.id.content), false)) .addFooterView(LayoutInflater.from(this).inflate(R.layout.item_footer_1, (ViewGroup) findViewById(android.R.id.content), false)) .addFooterView(LayoutInflater.from(this).inflate(R.layout.item_footer_2, (ViewGroup) findViewById(android.R.id.content), false)) .addFooterView(LayoutInflater.from(this).inflate(R.layout.item_footer_3, (ViewGroup) findViewById(android.R.id.content), false)) .onXBind(this) .setOnLongClickListener(this) .setOnItemClickListener(this) .setLoadingListener(this) .setFooterListener(this) .setRefreshing(true) );onXBind
Achieve data display
@Override public void onXBind(XViewHolder holder, int position, MainBean mainBean) { holder.setTextView(R.id.tv_name, mainBean.getName()); holder.setTextView(R.id.tv_age, mainBean.getAge() + ""); }
emptyView
Whether to display manually determined by the user's own network exceptions or data is empty when the call xRecyclerViewAdapter.isShowEmptyView (); specific examples of simplerecyclerView.setAdapter( xRecyclerViewAdapter .initXData(mainBean) .setEmptyView(findViewById(R.id.emptyView)) .addRecyclerView(recyclerView) .setLayoutId(R.layout.item) );
pull to refresh and load more
The default is not open, if necessary, please manually open, and addRecyclerViewxRecyclerViewAdapter .initXData(mainBean) .setLayoutId(R.layout.item) .addRecyclerView(recyclerView) .setPullRefreshEnabled(true) .setPullRefreshEnabled(true) .setLoadingListener(new XBaseAdapter.LoadingListener() { @Override public void onRefresh() { } @Override public void onLoadMore() { } })When the drop-down refresh is completeIt is up to the user to choose whether the load fails or is successfulxRecyclerViewAdapter.refreshComplete(HeaderLayout.STATE_DONE);When the pull-up is completeIt is up to the user to choose whether the load fails or is successfulxRecyclerViewAdapter.loadMoreComplete(FooterLayout.STATE_NOMORE);
addHeader addFooter
xRecyclerViewAdapter .addHeaderView(LayoutInflater.from(this).inflate(R.layout.item_header_1, (ViewGroup) findViewById(android.R.id.content), false)) .addFooterView(LayoutInflater.from(this).inflate(R.layout.item_footer_1, (ViewGroup) findViewById(android.R.id.content), false))
MultipleAdapter
Load the animation
XAdapter's refresh header and the bottom are derived from the XRecyclerView, so support for XRecyclerViewsupport animation, and the head and the bottom of the extension, you can set the background color, font color.xRecyclerViewAdapter .initXData(mainBeen) .addRecyclerView(recyclerView) .setLayoutId(R.layout.item) .setRefreshProgressStyle(ProgressStyle.BallSpinFadeLoader) .setLoadingMoreProgressStyle(ProgressStyle.BallRotate) .setImageView(R.drawable.iconfont_downgrey) .setHeaderBackgroundColor(R.color.colorBlack) .setFooterBackgroundColor(R.color.colorBlack) .setHeaderTextColor(R.color.textColor) .setFooterTextColor(R.color.textColor)
Thanks
https://github.com/jianghejie/XRecyclerView相关文章推荐
- XAdapter:支持下拉刷新加载和添加多个header和footer的RecyclerViewAdapter
- 重写recyclerview,支持下拉刷新、下拉加载更多、addHeader、addFoot、setEmptyView
- 你必须了解的RecyclerView的五大开源项目-解决上拉加载、下拉刷新和添加Header、Footer等问题
- RecyclerView五大开源项目-解决上拉加载、下拉刷新和添加Header、Footer等问题
- 一个能一句话添加header和Footer,并且能滑动删除和交换Item的RecyclerView
- 你必须了解的RecyclerView的五大开源项目-解决上拉加载、下拉刷新和添加Header、Footer等问题
- 解决RecyclerView上拉加载、下拉刷新、Header和Footer的第三方解决方案
- 支持addHeaderView、 addFooterView、分页加载数据的RecyclerView
- 解决RecyclerView上拉加载、下拉刷新、Header和Footer的第三方解决方案
- 一款下拉刷新以及上拉加载的控件库,扩展性强,使用简单。并附带有可以添加 header 和 footer 的 Recyclerview
- 你必须了解的RecyclerView的五大开源项目-解决上拉加载、下拉刷新和添加Header、Footer等问题
- 你必须了解的 RecyclerView 的五大开源项目 - 解决上拉加载、下拉刷新和添加 Header、Footer 等问题
- 你必须了解的RecyclerView的五大开源项目-解决上拉加载、下拉刷新和添加Header、Footer等问题
- 你必须了解的RecyclerView的五大开源项目-解决上拉加载、下拉刷新和添加Header、Footer等问题
- 详解自主实现RecyclerView下拉刷新、上拉加载、Header、Footer以及swiperefreshlayout的部分讲解
- 你必须了解的RecyclerView的五大开源项目-解决上拉加载、下拉刷新和添加Header、Footer等问题
- 你必须了解的RecyclerView的五大开源项目-解决上拉加载、下拉刷新和添加Header、Footer等问题
- 你必须了解的RecyclerView的五大开源项目-解决上拉加载、下拉刷新和添加Header、Footer等问题
- 你必须了解的RecyclerView的五大开源项目-解决上拉加载、下拉刷新和添加Header、Footer等问题
- Android Recycler View Header Footer 下拉刷新,自动加载更多,空view,loading view