All Projects → 823546371 → PullToRefresh

823546371 / PullToRefresh

Licence: other
下拉刷新库可自定义刷新加载

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to PullToRefresh

goRefresh
让下拉刷新炫酷起来~轻松接入lottie动画,支持listview recyclerview scrollerview webview 。同时支持listview和recyclerview上拉加载
Stars: ✭ 24 (-78.38%)
Mutual labels:  pulltorefresh, loadmore
AnimatedPullToRefresh-master
A Cool pull to refresh widget provided with character animation in header with user defined text. Customise your widget and show off your home screen!!
Stars: ✭ 38 (-65.77%)
Mutual labels:  pulltorefresh
Refreshui
RefreshUI provide native refresh control to SwiftUI.
Stars: ✭ 95 (-14.41%)
Mutual labels:  pulltorefresh
PullToRefresh
A PullToRefresh widget.
Stars: ✭ 510 (+359.46%)
Mutual labels:  pulltorefresh
Xrefreshlayout
【已过时,不再更新,请使用更强大的SmartRefreshLayout!】A refresh layout(无侵入下拉刷新和加载布局), can refresh RecyclerView for all LayoutManager, NestedScrollView。
Stars: ✭ 127 (+14.41%)
Mutual labels:  pulltorefresh
XCPullToLoadMoreListView
XCPullToLoadMoreListView-下拉加载更多ListView控件(仿QQ、微信聊天对话列表控件)
Stars: ✭ 24 (-78.38%)
Mutual labels:  pulltorefresh
Llmlistview
super list view for uwp
Stars: ✭ 27 (-75.68%)
Mutual labels:  pulltorefresh
ZRefreshLayout
一个可以全局随意配置头部的下拉刷新与上拉加载库;
Stars: ✭ 30 (-72.97%)
Mutual labels:  loadmore
FlightBookingApp
Xamarin.Forms goodlooking UI sample using the new SwipeView.
Stars: ✭ 26 (-76.58%)
Mutual labels:  pulltorefresh
RNAndroidPullToRefresh
React Native 封装基于 Ultra-Pull-To-Refresh 的下拉刷新控件
Stars: ✭ 17 (-84.68%)
Mutual labels:  pulltorefresh
Xrefreshview
一个万能的android下拉上拉刷新的框架,完美支持recyclerview
Stars: ✭ 1,685 (+1418.02%)
Mutual labels:  pulltorefresh
React Native Easy App
Simpler storage, Simpler fetch, Simpler UI
Stars: ✭ 214 (+92.79%)
Mutual labels:  pulltorefresh
PowerRefresh
Support nested scroll for refresh and load more.
Stars: ✭ 64 (-42.34%)
Mutual labels:  loadmore
Minirefresh
优雅的H5 下拉刷新。零依赖,高性能,多主题,易拓展。(A Graceful HTML5 Drop-Down-Refresh Plugin. )
Stars: ✭ 1,525 (+1273.87%)
Mutual labels:  pulltorefresh
Android-RecyclerView-Loadmore
RecyclerView Loadmore and Swipe refresh for LinearLayout GridLayout and StaggeredLayout
Stars: ✭ 27 (-75.68%)
Mutual labels:  loadmore
Pulltorefresh H5 Iscroll
基于IScroll5的PullToRefresh实现.。提供多套皮肤机制,便于拓展!
Stars: ✭ 56 (-49.55%)
Mutual labels:  pulltorefresh
pulltorefresh
android pull to refresh library
Stars: ✭ 13 (-88.29%)
Mutual labels:  pulltorefresh
android-page
android 分页列表数据加载引擎,主要封装了android分页列表数据加载的各个组件,如果你有一个需要分页加载的List列表,都可以使用此框架实现。
Stars: ✭ 15 (-86.49%)
Mutual labels:  pulltorefresh
WX MultiTabList
微信小程序,多个Tab列表的上下拉刷新方案
Stars: ✭ 25 (-77.48%)
Mutual labels:  loadmore
vuejs-loadmore
A pull-down refresh and pull-up loadmore scroll component for Vue.js. Vue上拉加载下拉刷新组件
Stars: ✭ 62 (-44.14%)
Mutual labels:  loadmore

PullToRefresh

开发者可以使用 PullToRefresh 对各种控件实现下拉刷新或者上拉加载以及可以自定义刷新和加载部分的视图。

目前支持:ScrollView ListViewWebViewRecyclerView

版本记录

v1.0.3

修复了滑动最小距离判断

v1.1.0

新增了空数据,加载中以及网络错误的3种状态页面

v1.2.0

1、修复了ypf168326 issue 并添加了例子 2、修复了刷新加载期间不能滑动的问题

v1.2.5

新增自定义不用每次都设置头部和底部demo

v1.2.6

1、fix bug
2、新增自动刷新(autoRefresh),禁止刷新(canRefresh)

v1.2.7

1、fix issue#9

效果图

基本用法

1、添加 Gradle 依赖

目前只支持 Android Studio

compile 'com.jwenfeng.pulltorefresh:library:1.2.7'

2、布局文件

注意:内容控件 有且只能有一个,目前支持:ScrollView ListViewWebViewRecyclerView

<?xml version="1.0" encoding="utf-8"?>
<com.jwenfeng.library.pulltorefresh.PullToRefreshLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/activity_main"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    
    <!-- 内容控件 有且只能有一个 -->
     <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent">
    
     </ScrollView>
    
</com.jwenfeng.library.pulltorefresh.PullToRefreshLayout>
    

3、在Activity或者Fragment中使用

pullToRefreshLayout.setRefreshListener(new BaseRefreshListener() {
            @Override
            public void refresh() {
                new Handler().postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        // 结束刷新
                        pullToRefreshLayout.finishRefresh();
                    }
                }, 2000);
            }

            @Override
            public void loadMore() {
                new Handler().postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        // 结束加载更多
                        pullToRefreshLayout.finishLoadMore();
                    }
                }, 2000);
            }
        });

4、自定义视图

自定义下拉刷新视图需要实现 HeadView 接口

public interface HeadView {

    /**
     * 开始下拉
     */
    void begin();

    /**
     * 回调的精度,单位为px
     *
     * @param progress 当前高度
     * @param all      总高度
     */
    void progress(float progress, float all);

    void finishing(float progress, float all);
    /**
     * 下拉完毕
     */
    void loading();

    /**
     * 看不见的状态
     */
    void normal();

    /**
     * 返回当前视图
     * */
    View getView();

}

具体请参考Demo中 HeadRefreshView

上拉加载更多用法和下拉刷新类似,具体参考 LoadMoreView.java

不用每次都设置头部和底部啦,可以继承PullToRefreshLayout,具体参考 NormalPullToRefreshLayout

5、其他

可以设置下拉刷新和上拉加载控件的高度和拉取的最大高度,默认为60dp,最大拉取为120dp,可自行设置。

6、v1.1.0 新增自定义3中状态页面

截图

用法

XML
<com.jwenfeng.library.pulltorefresh.PullToRefreshLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/activity_recycler_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:view_error="@layout/layout_error"
    app:view_empty="@layout/layout_empty"
    app:view_loading="@layout/layout_loading">

</com.jwenfeng.library.pulltorefresh.PullToRefreshLayout>

app:view_error 网络错误页面

app:view_empty 空数据页面

app:view_loading 加载中页面

该三个属性可以不填写,默认样式为上图所示,可以自定义

java用法
pullToRefreshLayout.showView(ViewStatus.LOADING_STATUS);

设置需要显示的视图

// 获取页面
View error = pullToRefreshLayout.getView(ViewStatus.ERROR_STATUS);

获取所需要的视图view

注意 一定要在调用了设置相应的视图之后才可以调用获取页面,否则view为空

License

Copyright 2016-2017 jinwenfeng

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].