Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/czy1121/loadinglayout
简单实用的页面多状态布局(content,loading,empty,error)
https://github.com/czy1121/loadinglayout
content empty error loading status
Last synced: about 1 month ago
JSON representation
简单实用的页面多状态布局(content,loading,empty,error)
- Host: GitHub
- URL: https://github.com/czy1121/loadinglayout
- Owner: czy1121
- License: apache-2.0
- Archived: true
- Created: 2016-11-30T06:21:26.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2020-06-08T06:01:33.000Z (over 4 years ago)
- Last Synced: 2024-08-03T01:26:19.376Z (4 months ago)
- Topics: content, empty, error, loading, status
- Language: Java
- Size: 172 KB
- Stars: 752
- Watchers: 10
- Forks: 110
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-github-android-ui - loadinglayout - 简单实用的页面多状态布局 (空白页)
README
# LoadingLayout [![](https://jitpack.io/v/czy1121/loadinglayout.svg)](https://jitpack.io/#czy1121/loadinglayout)
简单实用的页面多状态布局(content,loading,empty,error)
![loadinglayout1](screenshot1.png) ![loadinglayout2](screenshot2.png)
## Gradle
``` groovy
repositories {
maven { url "https://jitpack.io" }
}
dependencies {
compile 'com.github.czy1121:loadinglayout:1.0.1'
}
```
## Usage**在主题中设置默认样式**
``` xml
...
<item name="styleLoadingLayout">@style/LoadingLayoutStyle</item><item name="llEmptyImage">@mipmap/empty</item>
<item name="llErrorImage">@mipmap/error</item>
...```
**用法一:在布局中使用**
``` xml
```**用法二:包裹并替换内容元素**
``` java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// ...
vLoading = LoadingLayout.wrap(this);
vLoading.showContent();
// ...
}
```
**API**``` java
// 显示 content/loading/empty/error 布局
showContent()
showLoading()
showEmpty()
showError()// 设置 loading/empty/error 布局
setLoading(int resId)
setEmpty(int resId)
setError(int resId)// 设置空布局的图片与文本
setEmptyImage(int resId)
setEmptyText(String value)// 设置错误布局的图片与文本,
setErrorImage(int resId)
setErrorText(String value)// 设置重试按钮文本
setRetryText(String value)// 设置重试按钮的监听回调
setRetryListener(OnClickListener listener)```
**属性**
``` xml
```
## License
```
Copyright 2016 czy1121Licensed 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.
```