# 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>
* Bo Maryniuk
* [kidfolk](https://github.com/kidfolk)
* [Tim Mahoney](https://github.com/timahoney)
* [Richard Guest](https://github.com/quiffman)
## 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)
没有合适的资源?快使用搜索试试~ 我知道了~
android-pulltorefresh-master
共31个文件
xml:16个
png:9个
java:2个
需积分: 9 7 下载量 6 浏览量
2014-10-30
12:25:53
上传
评论
收藏 150KB ZIP 举报
温馨提示
android上拉下拉刷新 PullToRefresh Android-PullToRefresh-master 注释掉PullToRefreshViewPager 里面的viewPager.setId(R.id.viewpager); 就可以了
资源推荐
资源详情
资源评论
收起资源包目录
android-pulltorefresh-master.zip (31个子文件)
android-pulltorefresh-master
android-pull-to-refresh.png 115KB
pulltorefresh
src
com
markupartist
android
widget
PullToRefreshListView.java 14KB
AndroidManifest.xml 315B
res
values-sv
strings.xml 393B
values-ko
strings.xml 395B
values-zh-rHK
strings.xml 350B
drawable-ldpi
ic_pulltorefresh_arrow.png 281B
values-zh-rTW
strings.xml 350B
drawable-hdpi
ic_pulltorefresh_arrow.png 463B
values-ja
strings.xml 395B
drawable
icon.png 4KB
pull_to_refresh_header_background.xml 900B
drawable-mdpi
ic_pulltorefresh_arrow.png 400B
layout
pull_to_refresh_header.xml 3KB
values-pt
strings.xml 428B
values-ru
strings.xml 470B
values-de
strings.xml 397B
values
strings.xml 413B
values-zh
strings.xml 350B
default.properties 386B
README.md 3KB
.gitignore 38B
pulltorefreshexample
src
com
markupartist
android
example
pulltorefresh
PullToRefreshActivity.java 2KB
AndroidManifest.xml 811B
res
drawable-ldpi
icon.png 902B
drawable-hdpi
icon.png 1KB
drawable
icon.png 4KB
drawable-mdpi
icon.png 1KB
layout
pull_to_refresh.xml 528B
values
strings.xml 192B
default.properties 411B
共 31 条
- 1
资源评论
kvsj9
- 粉丝: 0
- 资源: 9
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- AIS2024 valid
- 最入门的爬虫代码 python.docx
- 爬虫零基础入门-爬取天气预报.pdf
- 最通俗易懂的 MongoDB 非结构化文档存储数据库教程.zip
- 以mongodb为数据库的订单物流小项目.zip
- 腾讯云-mongodb数据库, 项目部署.zip
- 腾讯 APIJSON 的 MongoDB 数据库插件.zip
- 理解非关系型数据库和关系型数据库的区别.zip
- 操作简单的Mongodb网页web管理工具,基于Spring Boot2.0支持mongodb集群.zip
- tms-mongodb-web,提供访问mongodb数据的REST API和可灵活扩展的mongodb web 客户端.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功