android-PullRefreshLayout-master
所属分类:其他
开发工具:Java
文件大小:1012KB
下载次数:0
上传日期:2018-06-12 10:20:48
上 传 者:
牛牛网
说明: 下拉刷新示例,一个页面很好看的下拉刷新示例,可以快速移植使用。
(Drop-down refresh example, a good example of a drop-down refresh page, can be quickly transplanted to use.)
文件列表:
LICENSE (1079, 2015-09-25)
build.gradle (645, 2015-09-25)
demo.gif (1102871, 2015-09-25)
gradle (0, 2015-09-25)
gradle\wrapper (0, 2015-09-25)
gradle\wrapper\gradle-wrapper.jar (49896, 2015-09-25)
gradlew (5080, 2015-09-25)
gradlew.bat (2404, 2015-09-25)
library (0, 2015-09-25)
library\build.gradle (2794, 2015-09-25)
library\proguard-rules.pro (665, 2015-09-25)
library\src (0, 2015-09-25)
library\src\androidTest (0, 2015-09-25)
library\src\androidTest\java (0, 2015-09-25)
library\src\androidTest\java\com (0, 2015-09-25)
library\src\androidTest\java\com\baoyz (0, 2015-09-25)
library\src\androidTest\java\com\baoyz\widget (0, 2015-09-25)
library\src\androidTest\java\com\baoyz\widget\ApplicationTest.java (347, 2015-09-25)
library\src\main (0, 2015-09-25)
library\src\main\AndroidManifest.xml (153, 2015-09-25)
library\src\main\java (0, 2015-09-25)
library\src\main\java\com (0, 2015-09-25)
library\src\main\java\com\baoyz (0, 2015-09-25)
library\src\main\java\com\baoyz\widget (0, 2015-09-25)
library\src\main\java\com\baoyz\widget\ArcDrawable.java (4327, 2015-09-25)
library\src\main\java\com\baoyz\widget\CirclesDrawable.java (7737, 2015-09-25)
library\src\main\java\com\baoyz\widget\MaterialDrawable.java (28931, 2015-09-25)
library\src\main\java\com\baoyz\widget\PullRefreshLayout.java (20683, 2015-09-25)
library\src\main\java\com\baoyz\widget\RefreshDrawable.java (1815, 2015-09-25)
library\src\main\java\com\baoyz\widget\RingDrawable.java (4124, 2015-09-25)
library\src\main\java\com\baoyz\widget\SmartisanDrawable.java (6476, 2015-09-25)
library\src\main\java\com\baoyz\widget\WaterDropDrawable.java (5049, 2015-09-25)
library\src\main\res (0, 2015-09-25)
library\src\main\res\values (0, 2015-09-25)
library\src\main\res\values\attrs.xml (553, 2015-09-25)
sample (0, 2015-09-25)
... ...
android-PullRefreshLayout
=========================
[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-android--PullRefreshLayout-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/1084)
This component like SwipeRefreshLayout, it is more beautiful than SwipeRefreshLayout.
# Demo
# Usage
Add dependency.
```
dependencies {
compile 'com.baoyz.pullrefreshlayout:library:1.2.0'
}
```
Use method like SwipeRefreshLayout's usage.
Use it in your layout xml.
```xml
```
Get instance and use it.
```java
PullRefreshLayout layout = (PullRefreshLayout) findViewById(...);
// listen refresh event
layout.setOnRefreshListener(new PullRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
// start refresh
}
});
// refresh complete
layout.setRefreshing(false);
```
Change the refresh style, there are five styles of use, `MATERIAL`、`CIRCLES`、 `WATER_DROP`、`RING` and `SMARTISAN`.
In java, call `setRefreshStyle` method.
```java
layout.setRefreshStyle(PullRefreshLayout.STYLE_CIRCLES);
```
In xml, use attributes.
```xml
```
Change the color scheme.
In java, call `setColorSchemeColors` method. The int array length must be 4.
```java
layout.setColorSchemeColors(int []);
```
For Smartisan style, it has only one color, can call 'setColor' method, to set one color.
```java
layout.setColor(int);
```
In xml, use attributes.
```xml
```
If you do not like these styles, you can customize the refresh style.
```java
class CustomDrawable extends RefreshDrawable{
@Override
public void setPercent(float percent) {
// Percentage of the maximum distance of the drop-down refresh.
}
@Override
public void setColorSchemeColors(int[] colorSchemeColors) {
}
@Override
public void offsetTopAndBottom(int offset) {
// Drop-down offset.
}
@Override
public void start() {
isRunning = true;
// Refresh started, start refresh animation.
}
@Override
public void stop() {
isRunning = false;
// Refresh completed, stop refresh animation.
}
@Override
public boolean isRunning() {
return isRunning;
}
@Override
public void draw(Canvas canvas) {
// Draw custom style.
}
}
```
Call `setRefreshDrawable()` method to use your custom refresh drawable.
```java
layout.setRefreshDrawable(new CustomDrawable());
```
# Thanks
* [SwipeRefreshLayout](https://developer.android.com/reference/android/support/v4/widget/SwipeRefreshLayout.html)
* [GoogleProgressBar](https://github.com/jpardogo/GoogleProgressBar)
License
=======
The MIT License (MIT)
Copyright (c) 2014 baoyongzhang
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
近期下载者:
相关文件:
收藏者: