# Pull To Refresh for Android
This project aims to provide a reusable pull to refresh widget for Android.
![Screenshot](https://github.com/johannilsson/android-pulltorefresh/raw/master/android-pull-to-refresh.png)
Repository at <https://github.com/johannilsson/android-pulltorefresh>.
## Usage
### Layout
``` xml
<!--
The PullToRefreshListView replaces a standard ListView widget.
-->
<com.markupartist.android.widget.PullToRefreshListView
android:id="@+id/android:list"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
/>
```
### Activity
``` java
// Set a listener to be invoked when the list should be refreshed.
((PullToRefreshListView) getListView()).setOnRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh() {
// Do work to refresh the list here.
new GetDataTask().execute();
}
});
private class GetDataTask extends AsyncTask<Void, Void, String[]> {
...
@Override
protected void onPostExecute(String[] result) {
mListItems.addFirst("Added after refresh...");
// Call onRefreshComplete when the list has been refreshed.
((PullToRefreshListView) getListView()).onRefreshComplete();
super.onPostExecute(result);
}
}
```
### Last Updated
It's possible to add a last updated time using the method `setLastUpdated`
and `onRefreshComplete`. The text provided to these methods will be set below
the Release to refresh text. Note that the time representation is not validated
replaces the previous text, which means that it's possible and recommended to
add a text similar to "Last Update: 15:23". This might be changed in future
versions.
## 1.5 Support
To use the widget on 1.5 the necessary drawables needs to be copied to that
projects drawable folder. The drawables needed by the widget can be found in
the drawable-hdpi folder in the library project.
## Contributors
* [Jason Knight](http://www.synthable.com/) - <https://github.com/synthable>
* [Eddie Ringle](http://eddieringle.com/) - <https://github.com/eddieringle>
* [Christof Dorner](http://chdorner.com) - <https://github.com/chdorner>
* [Olof Brickarp](http://www.yay.se) - <https://github.com/coolof>
* [James Smith](http://loopj.com/) - <https://github.com/loopj>
* [Alex Volovoy](http://bytesharp.com/) - <https://github.com/avolovoy>
## Are you using this widget?
If you are using this widget please feel free to add your app to the
[wiki](https://github.com/johannilsson/android-pulltorefresh/wiki/Apps).
## License
Copyright (c) 2011 [Johan Nilsson](http://markupartist.com)
Licensed under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html)
自定义listview,支持上拉刷新,下拉更多
![star](https://csdnimg.cn/release/downloadcmsfe/public/img/star.98a08eaa.png)
![avatar](https://profile-avatar.csdnimg.cn/default.jpg!1)
z180986697
- 粉丝: 0
- 资源: 4
最新资源
- 基于servlet+jsp+mysql的网上书店教程+源码.zip
- 华为HCIA-WLAN 3.0 课程视频(802.11标准介绍)
- GitHub存档仓库:功能、用途及使用方法详解
- 华为HCIA-WLAN 3.0 课程视频(无线通信的基本概念(下))
- C语言实战项目-贪吃蛇小游戏V1.0(附带全套源代码)
- 支持安装于Chromiu内核浏览器(谷歌Chrome、360极速、360安全、搜狗、QQ、UC、猎豹等)
- 华为HCIA-WLAN 3.0 课程视频(无线通信的基本概念(上))
- 多个关于c++的实际详细案例
- Delphi版本概览:演变、特性及差异分析
- 华为HCIA-WLAN 3.0 课程视频(WLAN面临的挑战及解决方案)
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)
- 1
- 2
- 3
- 4
- 5
- 6
前往页