All CategoriesAndroid App Development

ShimmerLayout in Android

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.
Shimmer_Layout1
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:

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
Shimmer_Layout6

Shimmer_Layout5

Shimmer_Layout5
Step 4: To define a shape, you need to add a file avatar_background.XML with below code:
Shimmer_Layout4
Step 5: Now, in MainActivity.java, we add shimmer layout and add a method startShimmerAnimation(), which will display shimmer layout with animation
Shimmer_Layout3

GitHub Link:

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

Output

ShimmerLayout

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.

Tags

One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Related Articles

Close
Close