Skip to content
Related Articles

Related Articles

Shimmer Effect to Image in Android

View Discussion
Improve Article
Save Article
Like Article
  • Last Updated : 23 Feb, 2021

Shimmer Effect is one of the most popular features that we see in most Android apps. We can get to see this Shimmer Effect while loading the screen in animated form. Using Shimmer Effect in the Android app makes a good User Experience. In this article, we are going to see how to implement the Shimmer Effect in the Android app. A sample GIF is given below to get an idea about what we are going to do in this article. Note that we are going to implement this project using the Java language. 

Applications of Shimmer Effect

  • Shimmer Effect is mostly used for loading the screen in an attractive form.
  • Shimmer Effect gives a good appearance to Images in the Android app.
  • Using Shimmer Effect in our app gives an Animated view of the image.

Step by Step Implementation

Step 1: Create a New Project

To create a new project in Android Studio please refer to How to Create/Start a New Project in Android Studio. Note that select Java as the programming language.

Step 2: Add dependency of Shimmer Effect library in build.gradle file

Then Navigate to gradle scripts and then to build.gradle(Module) level. Add below line in build.gradle file in the dependencies section.

implementation ‘com.facebook.shimmer:shimmer:0.5.0’

now click on Sync now it will sync your all files in build.gradle().

Step 3: Create a new Shimmer Effect in your activity_main.xml file

Navigate to the app > res > layout > activity_main.xml and add the below code to that file. Below is the code for the activity_main.xml file. 


<?xml version="1.0" encoding="utf-8"?>
    <!--Shimmer Effect-->
                android:src="@drawable/ic_baseline_account_balance_24" />
            <!--Text given to Image-->
                android:textStyle="bold" />
    <!--Button1 to start Shimmer Effect-->
        android:text="Start" />
    <!--Button2 to stop Shimmer Effect-->
        android:text="Stop" />

Step 4: Working with the file

Go to the file and refer to the following code. Below is the code for the file. Comments are added inside the code to understand the code in more detail.


import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import com.facebook.shimmer.ShimmerFrameLayout;
public class MainActivity extends AppCompatActivity {
    // Variables created for buttons and Shimmer
    Button button1, button2;
    ShimmerFrameLayout container;
    protected void onCreate(Bundle savedInstanceState) {
        button1 = findViewById(;
        button2 = findViewById(;
        // Button 1 to start Shimmer Effect
        button1.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                // If auto-start is set to false
        // Button 2 to stop Shimmer Effect
        button2.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                // If auto-start is set to false
        // Shimmer effect
        container = (ShimmerFrameLayout) findViewById(;

Now click on the run option it will take some time to build Gradle. After that, you will get output on your device as given below.


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!