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: 1 day ago
JSON representation

简单实用的页面多状态布局(content,loading,empty,error)

Lists

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 czy1121

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 at

http://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.
```