Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/MarkMjw/PullToRefresh
根据Maxwin的XListView改造而来,完善下拉刷新上拉加载更多的功能并实现自动刷新以及自动加载等功能, 并增加对ScrollView的支持。 原XListView参考链接:https://github.com/Maxwin-z/XListView-Android
https://github.com/MarkMjw/PullToRefresh
Last synced: 3 months ago
JSON representation
根据Maxwin的XListView改造而来,完善下拉刷新上拉加载更多的功能并实现自动刷新以及自动加载等功能, 并增加对ScrollView的支持。 原XListView参考链接:https://github.com/Maxwin-z/XListView-Android
- Host: GitHub
- URL: https://github.com/MarkMjw/PullToRefresh
- Owner: MarkMjw
- License: apache-2.0
- Created: 2013-10-08T08:24:56.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2016-12-29T00:48:56.000Z (almost 8 years ago)
- Last Synced: 2024-07-01T10:55:51.991Z (4 months ago)
- Language: Java
- Homepage:
- Size: 672 KB
- Stars: 691
- Watchers: 57
- Forks: 326
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
PullToRefresh
===========*注:本项目使用Android Studio开发*
### 根据Maxwin的XListView改造而来: ###
1.完善下拉刷新上拉加载更多的功能
2.并增加对ScrollView的支持
3.增加自动刷新以及滚动到底部自动加载功能原XListView参考链接:https://github.com/Maxwin-z/XListView-Android
## **XListView使用示例** ##
设置XListView相关属性
```java
mListView = (XListView) findViewById(R.id.list_view);
mListView.setPullRefreshEnable(true);
mListView.setPullLoadEnable(true);
mListView.setAutoLoadEnable(true);
mListView.setXListViewListener(this);
mListView.setRefreshTime(getTime());mAdapter = new ArrayAdapter(this, R.layout.vw_list_item, items);
mListView.setAdapter(mAdapter);
```下拉刷新,下拉加载更多使用示例
```java
@Override
public void onRefresh() {
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
mIndex = ++mRefreshIndex;
items.clear();
geneItems();
mAdapter = new ArrayAdapter(XListViewActivity.this, R.layout.vw_list_item,
items);
mListView.setAdapter(mAdapter);
onLoad();
}
}, 2500);
}@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if (hasFocus) {
mListView.autoRefresh();
}
}@Override
public void onLoadMore() {
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
geneItems();
mAdapter.notifyDataSetChanged();
onLoad();
}
}, 2500);
}
```## **XScrollView使用示例** ##
设置XScrollView相关属性
```java
mScrollView = (XScrollView) findViewById(R.id.scroll_view);
mScrollView.setPullRefreshEnable(true);
mScrollView.setPullLoadEnable(true);
mScrollView.setAutoLoadEnable(true);
mScrollView.setIXScrollViewListener(this);
mScrollView.setRefreshTime(getTime());View content = LayoutInflater.from(this).inflate(R.layout.vw_scroll_view_content, null);
if (null != content) {
mListView = (ListView) content.findViewById(R.id.content_list);
mListView.setFocusable(false);
mListView.setFocusableInTouchMode(false);mAdapter = new ArrayAdapter(this, R.layout.vw_list_item, mItems);
mListView.setAdapter(mAdapter);
measureHeight();
}mScrollView.setView(content);
```下拉刷新,下拉加载更多使用示例
```java
@Override
public void onRefresh() {
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
mIndex = ++mRefreshIndex;
mItems.clear();
geneItems();
mAdapter = new ArrayAdapter(XScrollViewActivity.this,
R.layout.vw_list_item, mItems);
mListView.setAdapter(mAdapter);
measureHeight();
onLoad();
}
}, 2500);
}@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);if (hasFocus) {
mScrollView.autoRefresh();
}
}@Override
public void onLoadMore() {
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
geneItems();
mAdapter.notifyDataSetChanged();
measureHeight();
onLoad();
}
}, 2500);
}
```##Screenshots
![Screenshot 0](https://raw.github.com/MarkMjw/PullToRefresh/master/Screenshots/0.png)![Screenshot 1](https://raw.github.com/MarkMjw/PullToRefresh/master/Screenshots/1.png)
![Screenshot 2](https://raw.github.com/MarkMjw/PullToRefresh/master/Screenshots/2.png)
![Screenshot 3](https://raw.github.com/MarkMjw/PullToRefresh/master/Screenshots/3.png)
License
=======Copyright (C) 2014 MarkMjw
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.