# LoadingLayout **Repository Path**: bx601880762/LoadingLayout ## Basic Information - **Project Name**: LoadingLayout - **Description**: Android LoadingLayout - **Primary Language**: Java - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-09-18 - **Last Updated**: 2024-12-31 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## LoadingLayout 方便的切换到加载中,空页面,出错页面和内容页面 ![效果图](https://github.com/XMFE-TEAM/LoadingLayout/raw/master/demo/demo.gif) 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()); ``` 当然,你也可以自己自定义各种视图 ``` ``` ## Gradle中使用 推荐使用jitpack ``` repositories { // ... maven { url "https://jitpack.io" } } dependencies { compile 'com.github.lzyzsd:XMFE-TEAM:LoadingLayout:0.1.0' } ``` ## License MIT