How to use Shimmer in Android

Antonius Eko Wibowo
2 min readJan 9, 2021
Shimmer Effect

Shimmer is an Android Library by Facebook. It gives shimmering effect to the UI. We know infinite progress can be represents by a lot of things, most common way is progress dialog.

Android Progress Dialog

Popular way right now is using shimmer. We can see in every popular apps right now.

So how to use shimmer in Android ? It’s quiet easy to do that. Like always, we just implement the SDK. If you are using gradle, use this code :

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

If you are using Maven, just implement this code :

<!-- Maven dependency on Shimmer for Android -->
<dependency>
<groupId>com.facebook.shimmer</groupId>
<artifactId>shimmer</artifactId>
<version>0.4.0</version>
</dependency>

Next go to the layout. Just open the layout xml where do you want to put the shimmer effect. Example is for your MainActivity, so open your activity_main.xml, and put this code :

<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>

If you specify the auto-start to false, then you have to put this code on your MainActivity. java to turn it on :

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

If you find this interesting, please share. I’ll be looking for your opinions and suggestions in the comments. Any feedback is welcome.

--

--