Coder Social home page Coder Social logo

echokoreyoshi / pulltorefreshlibrary Goto Github PK

View Code? Open in Web Editor NEW

This project forked from harichen/pulltorefreshlibrary

0.0 2.0 0.0 1.31 MB

[deprecated]支持瀑布流的下拉刷新和滑到底部加载更多,建议用RecycleView来实现

License: Apache License 2.0

Java 100.00%

pulltorefreshlibrary's Introduction

PullToRefreshLibrary

支持瀑布流的下拉刷新和滑到底部加载更多

实现原理:基于com.handmark.pulltorefresh和com.etsy.android.grid.StaggeredGridView

功能:下拉刷新;上拉加载更多(或滑动到底部自动加载,可自行选择调用)。

#使用须知

  1. 默认方式是上拉加载更多
  2. 滑动到底部自动加载只需简单的两步:

设置滑动监听

mPullToRefreshStaggeredGridView = (PullToRefreshStaggeredGridView) findViewById(R.id.sgv); mPullToRefreshStaggeredGridView.setOnRefreshListener(this); mPullToRefreshStaggeredGridView.setMode(Mode.BOTH); mPullToRefreshStaggeredGridView.setOnScrollListener(this);(this 是activity 或 fragment)

重写onScroll方法

@Override

public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) 
{
    boolean lastItemVisible = (totalItemCount > 0) && 
    (firstVisibleItem + visibleItemCount >= totalItemCount - 1);
    if (lastItemVisible) {
        mPullToRefreshStaggeredGridView.setPullUpToRefreshing(mPullToRefreshStaggeredGridView);
    }
}

下拉刷新效果:

下拉刷新

滑到底部自动加载效果:

滑到底部自动加载更多

pulltorefreshlibrary's People

Contributors

harichen avatar

Watchers

 avatar  avatar

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.