Giter VIP home page Giter VIP logo

smartrefresh's Introduction

SmartRefreshLayout

1. 在Module下的build.gradle中添加依赖

Step 1. Add the JitPack repository to your build file

allprojects {
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}

Step 2. Add the dependency

 dependencies {
        implementation 'com.github.Tudie:SmartRefresh:v1.0.7'
}

Step 3. Java代码设置

setEnableRefresh 是否开启下拉刷新功能(默认true)
setEnableLoadmore 是否开启加上拉加载功能(默认true)
setRefreshHeader(new ClassicsHeader(this));设置 Header 为 ClassicsHeader
setRefreshFooter(new ClassicsFooter(this));设置 Footer 为 ClassicsFooter

Step 4. xml布局

<com.scwang.smartrefresh.layout.SmartRefreshLayout
    android:id="@+id/smartLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#ffffff">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="120dp"
        android:padding="10dp"
        android:text="四大皆空法律上的困境发送即可范德萨个" />
</com.scwang.smartrefresh.layout.SmartRefreshLayout>

<com.scwang.smartrefresh.layout.SmartRefreshLayout
    android:id="@+id/smartLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#ffffff">

 <androidx.recyclerview.widget.RecyclerView
    android:id="@+id/recyclerview"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:overScrollMode="never"
    android:background="#fff" />
</com.scwang.smartrefresh.layout.SmartRefreshLayout>

// xml设置head 和 foot
<com.scwang.smartrefresh.layout.SmartRefreshLayout
    android:id="@+id/smartLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#ffffff">
    <com.scwang.smartrefresh.layout.header.ClassicsHeader
        android:layout_width="match_parent"
        android:layout_height="wrap_content"/>
    <TextView
        android:layout_width="match_parent"
        android:layout_height="120dp"
        android:padding="10dp"
        android:text="四大皆空法律上的困境发送即可范德萨个" />
    <com.scwang.smartrefresh.layout.footer.ClassicsFooter
        android:layout_width="match_parent"
        android:layout_height="wrap_content"/>
</com.scwang.smartrefresh.layout.SmartRefreshLayout>

Step 5. 代码源于SmartRefreshLayout

https://github.com/scwang90/SmartRefreshLayout

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.