Free Shipping

Secure Payment

easy returns

24/7 support

ShimmerLayout in Android

 July 15  | 0 Comments

ShimmerLayout in Android

ShimmerLayout is a new library which creates shimmer effects on layouts during Android Development. They create shimmer effects while one is working on big layouts to save memory.  The pioneer to create shimmer effects was Facebook. They had to create this for developing loading status. The ShimmerLayout library is open source and supports all android devices.
Nowadays, this type of animation is being used by all companies like LinkedIn, Udemy in their apps.

These classes will be used for Animation, It will help you to show Animations by Value or by Object, Read the description as below:

Classes:

ValueAnimator This class provides a simple time engine for executing animations which calculate animated values and set them on target basis.
ObjectAnimator This is a subclass of ValueAnimator class, it provides support for animating properties on target objects.

Below method will be used for starting an animation in shimmer pattern, Read the description as below:

Get Skilled in Android Development

Method:

startShimmerAnimation() This method is using to start shimmer animation. This method is called automatically when the layout is attached to the current window.

 Shimmer with an example

Now we will create a sample app, which gives complete information about working with ShimmerLayout in Android Development Course :
Step 1: Add project file in the main app.

 Add build.gradle(Module:app)

compile project(':shimmerlayout')

Add build.gradle(Module:shimmerlayout)

apply from: 'https://raw.github.com/chrisbanes/gradle-mvn-push/master/gradle-mvn-push.gradle'

Add ShimmerLayout class in activity_main.xml

Step 2: Add View descriptions like Image Avatars, Shimmer Description etc. for all shimmers as shown below

Step 4: Add the description of different Shimmer Layout divisions

 

Step 4: To define a shape, you need to add a file avatar_background.XML with below code:

Step 5: Now, in MainActivity.java, we add shimmer layout and add a method startShimmerAnimation(), which will display shimmer layout with animation

GitHub Link:

https://github.com/hiteshbpatel/Android_Blog_Projects/tree/master/ShimmerLayout-master

Output

 

Conclusion

Thus we can witness the usage of ShimmerLayout library in the above project. It can be said with assurance that there are no issues regarding the shimmer effect or the OutOfMemoryError exception. This library effect saves your memory. Thus, we can conclude that due to characteristics like memory efficiency, animation on a big layout with shimmer, the color, and the speed animation is retained.

>