MaterialPageStateLayout
介绍:
PageStateLayout 可以让你在 Activity, Fragment, ViewGroup 中显示[Loading][Empty][Error][Succeed][Requesting] 5种状态。
运行效果:
使用说明:
Improt library:
allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}
dependencies {
compile 'com.github.Syehunter:PageStateLayout:0.1.2.2'
}
支持如下方法:
//replace activity.setContentView()
pageStateLayout.load(activity, succeedView);
//parent instanceof ViewGroup
pageStateLayout.load(parent, suuccedView);
//use this if u don't want any containers
//such as in fragment.onCreateView, just return pageStateLayout
pageStateLayout.load(succeedView);
5种状态:
onLoading();
onEmpty();
onError();
onSucceed();
//In some activities u may want to show both the progressbar and succeedView, such as LoginActivity, then switch on this state
onRequesting();
如果你想用自己设计的界面替换这些页面,可以:
PageStateLayout.Builder.setLoadingView(resId);
PageStateLayout.Builder.setEmptyView(resId);
PageSateLayout.Builder.setErrorView(resId);
你还可以使用PageStateLayout.Builder中的方法来改变progressColor,errorImage,emptyPromt等。
已下载
0