Skip to content

A library for showing different types of layouts when a list view is empty

License

Notifications You must be signed in to change notification settings

yesidlazaro/Android-Empty-Layout

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Android Empty Layout

A library for showing different types of layouts when a list view is empty. These layouts can be shown when,

  • the list is loading
  • the list has no item to display
  • an error occured trying to load items

Loading animation is also supported.

Screenshots

alt text alt text alt text alt text

Usage

  1. Import the library project into your workspace.
  2. Use the imported project as a library for your project.
  3. In the onCreate event of your activity use the following code.
EmptyLayout emptyLayout = new EmptyLayout(this, getListView());
  1. When you want to show the loading animation, use this code.
emptyLayout.showLoading();
  1. When you want to show any error, use this code.
emptyLayout.showError();
  1. When your list doesn't have any item to show, use this code.
emptyLayout.showEmpty();

Thats all you have to do to use this library. You may want to customize its behavior though.

Customization

There are bunch of methods to let you customize this pattern. Use the methods like this.

emptyLayout.setLoadingMessage("Please wait...");

Some useful methods are given below

  • showEmpty
  • showLoading
  • showError
  • setLoadingView
  • setEmptyView
  • setErrorView
  • setLoadingAnimation
  • setErrorMessage
  • setLoadingMessage
  • setEmptyMessage
  • setEmptyViewButtonClickListener
  • setLoadingViewButtonClickListener
  • setErrorViewButtonClickListener
  • setShowEmptyButton
  • setShowLoadingButton
  • setShowErrorButton

and there is more...

Example

A simple example is also available.

About

A library for showing different types of layouts when a list view is empty

Resources

License

Stars

Watchers

Forks

Packages

No packages published