PullToRefresh上拉刷新下拉加载更多的使用
2017-12-08 00:19
519 查看
1.这回就不用导包了 只需要添加依赖
https://pan.baidu.com/s/1o8rBnVs 密码:094e
当然你想写一个简单的上拉和下拉的话 就只要导这library一个依赖就行了
其他的三个只不过是高级版的 功能更多一些
2.看图操作
3.看图操作
4.看图操作
5.看图操作
6.然后就是构建 在主函数中注册和设置Mode
7.主布局 这个布局也是也可以写
https://pan.baidu.com/s/1o8rBnVs 密码:094e
当然你想写一个简单的上拉和下拉的话 就只要导这library一个依赖就行了
其他的三个只不过是高级版的 功能更多一些
2.看图操作
3.看图操作
4.看图操作
5.看图操作
6.然后就是构建 在主函数中注册和设置Mode
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //注册pullTorefresh Fresco.initialize(getApplicationContext()); //http://www.qubaobei.com/ios/cf/dish_list.php?stage_id=1&limit=10&page=1 lv=findViewById(R.id.lv); //这句话必须写 不然你写的上拉加载数据没有任何效果 lv.setMode(PullToRefreshBase.Mode.BOTH); lv.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener2<ListView>() { @Override //这是下拉刷新的方法 public void onPullDownToRefresh(PullToRefreshBase<ListView> refreshView) { lv.postDelayed(new Runnable() { @Override public void run() { lv.onRefreshComplete(); } },2000); } //这是上拉加载更多的方法 @Override public void onPullUpToRefresh(PullToRefreshBase<ListView> refreshView) { lv.postDelayed(new Runnable() { @Override public void run() { lv.onRefreshComplete(); } },2000); } }); }
7.主布局 这个布局也是也可以写
com.handmark.pulltorefresh.library.PullToRefreshGridView这个布局 当然有很多的布局
<?xml version="1.0" encoding="utf-8"?> <LinearLayout 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" tools:context="comqq.example.hasee.myapplication.MainActivity" android:orientation="vertical"> <com.handmark.pulltorefresh.library.PullToRefreshListView android:id="@+id/lv" android:layout_width="match_parent" android:layout_height="match_parent"></com.handmark.pulltorefresh.library.PullToRefreshListView> </LinearLayout>
相关文章推荐
- 使用pullToRefresh进行下拉刷新和上拉加载
- Android - 框架】之刷新加载框架Ultra-Pull-To-Refresh的使用,及其自定义头部刷新和底部加载更多
- pulltoRefreshSwipeMenuListview-带侧滑的可下拉刷新、上拉加载更多的控件
- 使用pullToRefresh进行下拉刷新和上拉加载
- 针对自定义组件上拉刷新下拉加载更多PullToRefreshView的分析(二)
- 针对自定义组件上拉刷新下拉加载更多PullToRefreshView的分析(一)
- 【Android-PullToRefresh】 上拉刷新、下拉加载 使用详解
- listView利用BaseAdapter及异步任务Gson解析,使用Picasso网络获取资源进行图文混排,PullToRefresh上拉刷新下拉加载
- android使用PullToRefresh实现上拉加载和下拉刷新效果
- PullToRefresh 上拉刷新,下拉加载数据 框架的简单使用
- Android使用PullToRefresh实现上拉加载和下拉刷新效果的代码
- 针对自定义组件上拉刷新下拉加载更多PullToRefreshView的分析(一)
- android使用PullToRefresh实现上拉加载和下拉刷新效果
- 将上拉加载更多下拉刷新PullToRefreshView用到项目中去
- 超简单的 listview的第三方控件PullToRefreshListView 上拉刷新,下拉加载更多,分页加载
- 使用Android开源工具PullToRefresh实现上啦刷新下拉加载
- android使用PullToRefresh实现上拉加载和下拉刷新效果
- 上拉刷新 下拉加载更多-PullToRefreshListView的简介
- 使用pullToRefresh进行下拉刷新和上拉加载
- 上拉刷新下拉加载控件-PullToRefresh