Android LoadingLayout
方便的切换到加载中,空页面,出错页面和内容页面
LoadingLayout集成自Framelayout,默认把第一个子view当做内容视图,其他的子view会被忽略
使用如下:
可以通过代码来切换到不同的view
final LoadingLayout loadingLayout = (LoadingLayout) findViewById(R.id.loading_layout);
findViewById(R.id.btn_show_content).setOnClickListener((view) -> loadingLayout.showContent());
findViewById(R.id.btn_show_error).setOnClickListener((view) -> loadingLayout.showError());
findViewById(R.id.btn_show_empty).setOnClickListener((view) -> loadingLayout.showEmpty());
findViewById(R.id.btn_show_loading).setOnClickListener((view) -> loadingLayout.showLoading());另外,针对errorView和emptyView,提供了两个重新加载的按钮。 需要注意的是,这里的重新加载的按钮的id必须是btn_error_retry或者btn_empty_retry
loadingLayout.setOnRetryClickListener((view) -> loadingLayout.showLoading());当然,你也可以自己自定义各种视图
推荐使用jitpack
repositories {
// ...
maven { url "https://jitpack.io" }
}
dependencies {
compile 'com.github.lzyzsd:XMFE-TEAM:LoadingLayout:0.1.0'
}MIT
No open issues yet, or sync has not completed.