--ADVERTISEMENT--

Loader in android is one of the great components. Loader can be shown at the time of getting data from server. Getting data from server may take few seconds during which we can show loader/progress to the user instead of blank activity/page. Loaders are of different types like circular progress loader, horizontal loader, rotate ball loader, square spin loader, ball scale and line scale loader, ball grid beat loader spin fade loader and many more. In this tutorial, you will learn to implement material design loader in your android application/game.

Here, I have shown you more than 6 material design loaders. You can use any of them in your app. I have placed all 7-8 loader in a single activity and you can choose one of these and add in your app.

Related:
Adding Circular Progress Ring to Android FAB (Floating Action Button)
Material Design Circular ProgressBar For Android
Android Material Design with Design Support Library

Android Example: How to Implement Material Design Loader


Let’s start by adding compile 'com.wang.avi:library:1.0.3' and compile 'com.nineoldandroids:library:2.4.0' dependencies in your app build.gradle file. Build.gradle file will look like below.

build.gradle

XML Layout File

In XML layout file I am going to add multiple com.wang.avi.AVLoadingIndicatorView widgets with different attributes. Give an unique id to each of them and add android:visibility="visible", app:indicator="LoaderStyle", app:indicator_color="#ff00". Replace LoaderStyle with one of BallPulse, BallGridPulse, SquareSpin, BallClipRotateMultiple, BallTrianglePath, LineScale, BallGridBeat. Following is the complete content of XML layout file.

res/layout/material_design_loader_progress_android_example.xml

Java Activity File

In java activity file you need to activate loader by calling findViewById and set visibility visible for each loader widgets. Java activity file will look like below.

src/AndroidMaterialDesignLoaderExample.java

Android Example: How to Implement Material Design Loader

You have done all things. Now, run your Material Design Loader Examples for Android with Source Code application, you will see different loaders with animation effect which will look like above screenshot. Choose which you like among these loaders and implement in your app/game.

Post a Comment

Powered by Blogger.