Skip to content

jenzz/Android-MultiStateListView

Repository files navigation

Android - MultiStateListView

A simple Android ListView that lets you define three states:

  • Loading
  • Empty
  • Error

Screenshots

alt text  alt text  alt text  alt text

Usage

  • Define the MultiStateListView via XML (use custom attributes to reference the state layouts):
<com.jensdriller.libs.multistatelistview.MultiStateListView
        android:id="@+id/list"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        custom:emptyView="@layout/empty_view"
        custom:errorView="@layout/error_view"
        custom:loadingView="@layout/loading_view" />
  • Or build it via Java:
  MultiStateListView multiStateListView = new MultiStateListView.Builder(this)//
  .loadingView(R.layout.loading_view)//
  .emptyView(R.layout.empty_view)//
  .errorView(R.layout.error_view)//
  .build();
  • Show the desired state based on your logic:
  multiStateListView.showLoadingView();
  multiStateListView.showEmptyView();
  multiStateListView.showErrorView();

Example

Check out the sample project for an example implementation.

Download

Grab it via Gradle:

compile 'com.github.jenzz.multistatelistview:library:1.0'

or Maven:

<dependency>
  <groupId>com.github.jenzz.multistatelistview</groupId>
  <artifactId>library</artifactId>
  <version>1.0</version>
</dependency>

License

This project is licensed under the MIT License.

About

A simple Android ListView that lets you define three states: Loading, Empty & Error

Resources

License

Stars

Watchers

Forks

Packages

No packages published