ArhamTechMind

Building future while learning

Shimmer effect in android app Facebook shimmer

1 min read

Shimmer effect in android app Facebook shimmer in Android Studio.This is Content Placeholder Animation like Facebook using Shimmer. When the app wants to load the data from a network call,we normally use  loaders Instead of using the usual loaders, we can make the loading screen more interesting using Facebook’s Shimmer library. This library adds Shimmer effect on to any custom view that we define.It is good practice to use loader while data is loading from network.Shimmer effect in app Facebook will make app looks good

To include Shimmer in your project, add the following dependency:

// Gradle dependency on Shimmer for Android
dependencies {
  implementation 'com.facebook.shimmer:shimmer:0.5.0'
}
    

How to use..?

The following snippet shows how you can use ShimmerFrameLayout

<com.facebook.shimmer.ShimmerFrameLayout
     android:id="@+id/shimmer_view_container"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
>
     ...(your complex view here)...
</com.facebook.shimmer.ShimmerFrameLayout>
   

And that’s it! If you specify `auto-start` to be false, then you can start the animation in code:

ShimmerFrameLayout container =
  (ShimmerFrameLayout) findViewById(R.id.shimmer_view_container);
container.startShimmer(); // If auto-start is set to false

 

Leave a Reply

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