https://github.com/leftcoding/leftyan
工具库
https://github.com/leftcoding/leftyan
Last synced: 8 months ago
JSON representation
工具库
- Host: GitHub
- URL: https://github.com/leftcoding/leftyan
- Owner: leftcoding
- Created: 2017-08-03T03:06:01.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-08-08T06:21:41.000Z (almost 9 years ago)
- Last Synced: 2024-10-19T03:03:38.595Z (over 1 year ago)
- Language: Java
- Homepage:
- Size: 186 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[  ](https://bintray.com/left/maven/multiple-lib/_latestVersion)
# MultipleStatusView
### 使用 ###
gradle 使用
```
compile 'com.ling.leftyan:multiple-lib:0.0.1'
```
```
//要显示内容的布局
```
默认情况下,显示内容界面。可以在初始化时,显示加载界面。
```
mMultipleStatusView = (MultipleStatusView) findViewById(R.id.multiple);
//数据请求开始
mMultipleStatusView.showLoading();//显示加载界面
//数据请求结束
//根据需求,显示不同的界面
mMultipleStatusView.showContent();//显示内容界面
mMultipleStatusView.showDisNetwork();//显示无网络界面
mMultipleStatusView.showError();//显示加载错界面
mMultipleStatusView.showEmpty();//显示空数据界面
```
### 自定义界面 ###
multiple-lib 库中,已经包含了4个基本的界面。
默认无网络界面:

用户可以通过设置,显示自定义界面
```
```
> app:dis_network_view="@layout/custom_disnetwork" //设置自定义无网络界面
```
//显示内容
```
自定义无网络界面:

### 界面点击事件处理 ###
上面已经自定义过了DisNetwork布局,直接使用。
```
View disNetWorkView = mMultipleStatusView.getDisNotWork();//获取你要处理的界面视图
if (disNetWorkView != null) {
TextView customText = (TextView) disNetWorkView.findViewById(R.id.custom_disnetwork_txt);
customText.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(MainActivity.this, "自定义DisNetwork 控件点击了", Toast.LENGTH_SHORT).show();
}
});
disNetWorkView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(MainActivity.this, "自定义DisNetwork 界面点击了", Toast.LENGTH_SHORT).show();
}
});
}
```
### 声明 ###
Copyright 2016 LeftCoding
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.