GithubHelp home page GithubHelp logo

qstumn / refreshlayout Goto Github PK

View Code? Open in Web Editor NEW
73.0 2.0 17.0 4.06 MB

为任意View添加下拉刷新上拉加载更多的功能,支持NestedScrolling特性

License: Apache License 2.0

Java 100.00%
refreshlayout

refreshlayout's Introduction

QRefreshLayout

Download

为任意View添加下拉刷新上拉加载更多的功能,支持NestedScrolling特性

how to use:

1. gradle

    compile 'q.rorbin:QRefreshLayout:1.2.4'  

VERSION_CODE here

2. xml

    <q.rorbin.qrefreshlayout.QRefreshLayout
        android:id="@+id/refreshlayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        
        <ListView 
            android:id="@+id/listview"
            android:layout_width="match_parent"
            android:layout_height="match_parent"/>
            
    </q.rorbin.qrefreshlayout.QRefreshLayout>

3. code

如果需要上拉加载更多功能,请调用以下方法

  mRefreshLayout.setLoadMoreEnable(true);

设置监听

    mRefreshLayout.setRefreshHandler(new RefreshHandler() {
    
            @Override
            public void onRefresh(QRefreshLayout refresh) {
                do something...
                mRefreshLayout.refreshComplete();
            }
            
            @Override
            public void onLoadMore(QRefreshLayout refresh) {
                do something...
                mRefreshLayout.LoadMoreComplete();
            }
        });

如果你想自定义头部或者尾部的View,只需要将你的View继承自QLoadView或  实现ILoadView接口

  public class CustomView extends QLoadView
  public class CustomView implements ILoadView

  然后再设置进布局

  mRefreshLayout.setHeaderView(new CustomView());
  mRefreshLayout.setFooterView(new CustomView());

  LoadView已有三种实现类供您选择使用,分别为:HeaderView(FooterView)、MaterialHeaderView(MaterialFooterView)、MaterialBlackHeaderView(MaterialBlackFooterView),QRefreshLayout默认设置为HeaderView

4. 属性说明

xml code 说明
app:resistance setResistance 设置下拉阻力(范围0f~1f)

LICENSE

Copyright 2016, RorbinQiu

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.

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.