• Stars
    star
    161
  • Rank 233,470 (Top 5 %)
  • Language
    Java
  • Created almost 9 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

RecyclerView with Footer

#RecyclerViewWithFooter

之所以会写这个库,是因为最近遇到朋友问推荐一个好的下拉刷新的库,然后我就给了我收集的BeautifulRefreshLayout,但是,这时候又有个问题,明明这个库写的很好,就是因为没有加载更多,而另一个库设计的没前一个库好,只是功能比上个库多,所以选择了下一个。对于这种情况我是反对的,呵呵。

举个例子吧,我觉得官方的SwipeRefreshLayout已经是个很好的控件了,就是没有上拉刷新,所以很多人没用,特别是初学android的朋友,因为我们需要有一个库可以解决一切问题,对于这种情况,我给的demo已经很好的解决。

随意说说,为什么很多人不把上拉下拉融合在一起,至少我们的理解是他们是一体的,对,你这样想是没错。但是,我觉得这要看项目的具体情况。我之前写的MaterialRefreshLayout就具备了,但是,上拉的时候需要用户自己拉,呵呵,我觉得很多余,另外,那个项目bug很多,慎用。呵呵... 所以,加载更多就是需要滑到底部自动加载,之前是 ListView.addFooterView(view) 的方法,常用作auto loading view ,但是RecyclerView 没有提供这个方法,没事,我写了 。

说了那么多废话,我们还是说说这个项目的功能吧。顾名思义,其实它就是一个给RecyclerView加底部View的库

使用

xml中的布局:

   <com.cjj.RecyclerViewWithFooter
            android:id="@+id/rv_load_more"
            android:layout_width="match_parent"
            android:layout_height="match_parent"/>

java中

     mRecyclerViewWithFooter = (RecyclerViewWithFooter) this.findViewById(R.id.rv_load_more);
     mRecyclerViewWithFooter.setAdapter();

这样就可以了,是不是很简单,呵呵。

如果需要监听Rv滑到底部,

 mRecyclerViewWithFooter.setOnLoadMoreListener(new OnLoadMoreListener() {
            @Override
            public void onLoadMore() {
                //加载数据
            }
        });

RecyclerViewWithFooter有三种类型,分别是:

   /**
     * 表示现在是切换成 load 状态
     */
    public void setLoad() {
    }

    /**
     * 表示切换成没有更多数据状态
     *
     * @param end
     */
    public void setEnd(CharSequence end) {

    }

    /**
     * 表示切换成 无数据 为空状态
     *
     * @param empty
     * @param resId
     */
    public void setEmpty(CharSequence empty, @DrawableRes int resId) {
    
    }

底部FootView如果不设置setFootItem,默认为DefaultFootItem,内嵌入了MaterialFootItem,效果如下:

(1)这是默认的效果

(2)这是Material风格的

(3)你也可以自己定义

差不多就这些了,想了解更多自己看源码。还有项目肯定存在bug,选择权在于你,不要出了bug就找骂原作者,你没有资格,因为如果你不用,有个屁的bug,如果你用了出问题可以加

GitHub小伙伴交流群'' 477826523

进群有要求,至少你Github有东西,别问为什么,原则问题,呵呵。我也是个菜鸟,也希望高手能帮我,呵呵

特别鸣谢:

dim,markzhai我死基友,呵呵

我的微博:

http://weibo.com/chenjijun2011

License

The MIT License (MIT)

Copyright (c) 2015 android-cjj

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

More Repositories

1

JJSearchViewAnim

A cool search view animation library
Java
2,374
star
2

BeautifulRefreshLayout

A bueautiful RefreshLayout
Java
2,158
star
3

Android-MaterialRefreshLayout

This is a drop-down control, it is more beautiful and powerful than SwipeRefreshLayout
Java
2,111
star
4

SnailBar

A lovely snail,You can use it as a seekbar or progressbar.
Java
525
star
5

ComicReader

漫画App
Java
493
star
6

BottomSheets

Teach you how to use Design Support Library: Bottom Sheets
Java
410
star
7

Android-MaterialDeleteLayout

Maetrial Design Delete Concept Implement
Java
353
star
8

Persei.android

Animated top menu for ListView or RecyclerView or ScrollView or GridView ...
Java
319
star
9

MousePaint

鼠绘漫画(非官方),我做着玩的
Java
297
star
10

MaterialSearchView

A beautiful Material SearchView
Java
279
star
11

BiliClient

bb
Java
172
star
12

SourceAnalysis

the source code
166
star
13

JJSwipeBack

activity finish like 简书,
Java
120
star
14

HaoKanRefresh

好看
Java
116
star
15

Timer

一个倒计时类,除了可以开始取消倒计时,还可以暂停恢复倒计时,虽说时间一去不复返,我丫停停它总可以吧!啊哈哈
Java
61
star
16

Like

45
star
17

nices

a simple news app
Java
36
star
18

JJSwipeLayout

The Sample Swipe Layout!
Java
29
star
19

createcjj

Java
21
star
20

OneStep

just a one step share demo
Java
16
star
21

JJAdapter

a simple adapter easy to use
Java
15
star
22

SunViewLayout

A lovely sun
Java
14
star
23

EasyView

A simple view like cardView
Java
11
star
24

DragMenu

dragmenu use ViewDragHelper
Java
10
star
25

VolleyFrame

this project tell you how to use the Volley by cjj
Java
9
star
26

ViewSelector

select view
Java
9
star
27

LoadingFrame

Java
9
star
28

HTTP

A frame for web
Java
7
star
29

NarutoPringting

火影印花
Java
6
star
30

DragMenu_2

Dragmenu
Java
4
star
31

DelAnim

delete anim
Java
3
star
32

Anmation

收集android动画开源项目(Collect android anmation open source projects)
2
star
33

EasyVolley

简单使用volley
Java
2
star