https://github.com/yangchaojiang/demoloadview
切换加载中,加载失败,加载成功布局,定义一个LoadViewHelper所有界面通用,通同时也支持单个自定义无需添加布局中view, 大大降低耦合性
https://github.com/yangchaojiang/demoloadview
android loading
Last synced: 6 months ago
JSON representation
切换加载中,加载失败,加载成功布局,定义一个LoadViewHelper所有界面通用,通同时也支持单个自定义无需添加布局中view, 大大降低耦合性
- Host: GitHub
- URL: https://github.com/yangchaojiang/demoloadview
- Owner: yangchaojiang
- Created: 2017-04-30T09:30:36.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-08-01T09:53:06.000Z (almost 7 years ago)
- Last Synced: 2024-12-11T02:34:18.761Z (6 months ago)
- Topics: android, loading
- Language: Java
- Homepage:
- Size: 14.3 MB
- Stars: 221
- Watchers: 3
- Forks: 12
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# LoadViewHelper
#切换加载中,加载失败,加载成功布局,支持全局和局部之自定义布局 定义一个LoadViewHelper所有界面通用,无需添加布局中view, 大大降低耦合性。
## LoadViewHelper
通过Gradle抓取:```gradle
compile 'com.ycjiang:loadviewhelper:1.1.2'```

### 在你Framgment 或者ACtivity
```
LoadViewHelper helper = new LoadViewHelper(listView);
//将listview切换成显示加载中布局helper.showLoading("加载中...");
//将listview切换成显示空数据布局
helper.showEmpty("暂无数据", "重试");
//或者
helper.showEmpty();
// 监听重试按钮
helper.setListener(new OnLoadViewListener() {
@Override
public void onRetryClick() {
Toast.makeText(getApplicationContext(), "点击了重试", Toast.LENGTH_SHORT).show();
}
});
```## 可以 自定义 加载中,加载失败,加载为空 布局 实现自己加载效果
### 使用全部自定义布局
```
public class App extends Application {@Override
public void onCreate() {
super.onCreate();
LoadViewHelper.getBuilder()
.setLoadEmpty(R.layout.this_empty)
.setLoadError(R.layout.this_error)
.setLoadIng(R.layout.this_load_ing);
}
}
```### 使用局部自定义布局
```
helper.setLoadEmpty(view)
helper.setLoadEmpty(resId);
helper.getLoadIng(view);
helper.getLoadIng(resId);
```
### 更新日志
#### 1.1.2
* 1.修复点击重试出现一直处于loading中.
#### 1.1.0
* 1.优化内部处理,代码更简洁 .
* 1.增加谈出谈入效果。