GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - Airoyee/NsRefreshLayout: 一款支持任意View的下拉刷新控件,支持上拉加载更多。

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

7 Commits
7 Commits

Folders and files

NameName
Last commit message
Last commit date
.idea
.idea
 
 
app
app
 
 
art
art
 
 
gradle/wrapper
gradle/wrapper
 
 
nrl
nrl
 
 
.gitignore
.gitignore
 
 
README.md
README.md
 
 
build.gradle
build.gradle
 
 
gradle.properties
gradle.properties
 
 
gradlew
gradlew
 
 
gradlew.bat
gradlew.bat
 
 
principles.md
principles.md
 
 
settings.gradle
settings.gradle
 
 

Repository files navigation

NsRefreshLayout

支持任意View的下拉刷新控件,同时支持上拉加载更多。实现原理:http://blog.csdn.net/xiaomoit/article/details/50469810

效果预览

demo

属性说明

<declare-styleable name="NsRefreshLayout">
    <!--Loading视图背景颜色-->
    <attr name="load_view_bg_color" format="color|reference"/>
    <!--进度条颜色-->
    <attr name="progress_bar_color" format="color|reference"/>
    <!--进度条背景色-->
    <attr name="progress_bg_color" format="color|reference"/>
    <!--Loading视图中文字颜色-->
    <attr name="load_text_color" format="color|reference"/>
    <!--下拉刷新问题描述-->
    <attr name="pull_refresh_text" format="string|reference"/>
    <!--上拉加载文字描述-->
    <attr name="pull_load_text" format="string|reference"/>
    <!--是否自动触发加载更多-->
    <attr name="auto_load_more" format="boolean"/>
    <!--下拉刷新是否可用-->
    <attr name="pull_refresh_enable" format="boolean"/>
    <!--上拉加载是否可用-->
    <attr name="pull_load_enable" format="boolean"/>
</declare-styleable>

举例

<?xml version="1.0" encoding="utf-8"?>
<com.xlf.nrl.NsRefreshLayout
    android:id="@+id/nrl_test"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:auto_load_more="false"
    tools:context="com.xlf.nrl.demo.MainActivity">

    <android.support.v7.widget.RecyclerView
        android:id="@+id/rv_test"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layoutManager="LinearLayoutManager"
        tools:listitem="@layout/item_test"/>
</com.xlf.nrl.NsRefreshLayout>
package com.xlf.nrl.demo;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.RecyclerView;
import android.view.Menu;
import android.view.MenuItem;

import com.xlf.nrl.NsRefreshLayout;

public class MainActivity extends AppCompatActivity implements
        NsRefreshLayout.NsRefreshLayoutController, NsRefreshLayout.NsRefreshLayoutListener {

    private boolean loadMoreEnable = true;
    private NsRefreshLayout refreshLayout;
    private RecyclerView rvTest;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        refreshLayout = (NsRefreshLayout) findViewById(R.id.nrl_test);
        refreshLayout.setRefreshLayoutController(this);
        refreshLayout.setRefreshLayoutListener(this);

        rvTest = (RecyclerView) findViewById(R.id.rv_test);
        TestRecyclerAdapter adapter = new TestRecyclerAdapter(this);
        rvTest.setAdapter(adapter);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        MenuItem item = menu.add(0, 0, 0, "禁用上拉加载功能");
        item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        loadMoreEnable = false;
        return true;
    }

    @Override
    public boolean isPullRefreshEnable() {
        return true;
    }

    @Override
    public boolean isPullLoadEnable() {
        return loadMoreEnable;
    }

    @Override
    public void onRefresh() {
        refreshLayout.postDelayed(new Runnable() {
            @Override
            public void run() {
                refreshLayout.finishPullRefresh();
            }
        }, 1000);
    }

    @Override
    public void onLoadMore() {
        refreshLayout.postDelayed(new Runnable() {
            @Override
            public void run() {
                refreshLayout.finishPullLoad();
            }
        }, 1000);
    }

}

License


Mozilla Public License, version 2.0

About

一款支持任意View的下拉刷新控件,支持上拉加载更多。

Resources

Readme
Activity

Stars

0 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.