当前位置: 代码迷 >> 综合 >> RecyclerView 和 SwipeRefreshLayout
  详细解决方案

RecyclerView 和 SwipeRefreshLayout

热度:39   发布时间:2023-12-16 14:13:59.0

1: 下拉刷新,上拉加载

2:  注意数据更新,还有recycelerview的adapter

3: RecyclerView 是需要导入的,然后才能够应用的

 

https://github.com/kodulf/SwipeRefreshLayoutRecyclerViewDemo

 

package kodulf.swiperefreshlayoutrecyclerviewdemo;import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.annotation.NonNull;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toast;import java.util.ArrayList;public class MainActivity extends AppCompatActivity implements SwipeRefreshLayout.OnRefreshListener, View.OnScrollChangeListener {private RecyclerView recyclerView;private SwipeRefreshLayout mSwipeRefreshLayout;private ArrayList<String> mList = new ArrayList<>();private MyAdapter myAdapter;private static final int ADD = 0;private static f
  相关解决方案