Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/linuxjava/HorizontalRefreshLayout
https://github.com/linuxjava/HorizontalRefreshLayout
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/linuxjava/HorizontalRefreshLayout
- Owner: linuxjava
- Created: 2017-02-13T09:56:58.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-02-15T08:56:05.000Z (almost 8 years ago)
- Last Synced: 2024-08-03T01:23:32.352Z (6 months ago)
- Language: Java
- Size: 16.5 MB
- Stars: 155
- Watchers: 4
- Forks: 19
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-github-android-ui - HorizontalRefreshLayout - 实现左右刷新 (下拉刷新)
README
:running:HorizontalRefreshLayout-Android:running:
============开发者使用 HorizontalRefreshLayout-Android 可以对RecycView、Listview、ScrollView等控件实现左右刷新
## APK下载
[Download](https://github.com/linuxjava/HorizontalRefreshLayout/raw/master/apk/app-debug.apk)
## Demo使用
运行demo需删除gradle.properties中的代理
```xml
systemProp.http.proxyHost=dev-proxy.oa.com
systemProp.http.proxyPort=8080
systemProp.https.proxyHost=dev-proxy.oa.com
systemProp.https.proxyPort=8080
```
## Gradle配置
compile 'xiao.free.horizontalrefreshlayout:lib:v0.1.2'
## XML配置
```xml
```
## Java代码
```java
refreshLayout = (HorizontalRefreshLayout) findViewById(R.id.refresh);
refreshLayout.setRefreshCallback(this);
refreshLayout.setRefreshHeader(new LoadingRefreshHeader(this), HorizontalRefreshLayout.LEFT);
refreshLayout.setRefreshHeader(new LoadingRefreshHeader(this), HorizontalRefreshLayout.RIGHT);
```
通过setRefreshHeader方法可以设置左右刷新头部,库中已支持三种刷新效果,如下图所示:![image](https://github.com/linuxjava/HorizontalRefreshLayout/raw/master/gif/1.gif)
![image](https://github.com/linuxjava/HorizontalRefreshLayout/raw/master/gif/2.gif)
![image](https://github.com/linuxjava/HorizontalRefreshLayout/raw/master/gif/3.gif)## 自定义Header
可通过实现如下接口实现自定义header
```java
public interface RefreshHeader {
/**
* @param dragPosition HorizontalRefreshLayout.START or HorizontalRefreshLayout.END
*/
void onStart(int dragPosition, View refreshHead);/**
* @param distance
*/
void onDragging(float distance, float percent, View refreshHead);void onReadyToRelease(View refreshHead);
@NonNull View getView(ViewGroup container);
void onRefreshing(View refreshHead);
}
```
具体可参考lib库中refreshhead目录中的实现