How to Implement Material Design Ripple Effect in Android

0 739

Material Design Ripple Effect

Today I will describe how to implement Material Design Ripple Effect in Android. But you should know what ripple effect is when it comes to Android.

Ripple Effect

When users interact with UI elements at that point of contact, touch feedback in material design provides an instantaneous visual confirmation. For example, Buttons now display a ripple effect when they are touched which is the default touch feedback animation on Android 5.0.

Ripple Effect is compatible with devices running lollipop and above. You can easily add ripple effects in your android, layouts, buttons, text views and etc. You can also modify its color. There are different types of Ripple Effect for example; circular, rectangle etc. We can set ripple effect on Android in two ways.

One is by creating a custom XML file in the drawable folder by using custom color value or by using default attr value in the background. Have a look at how I implement Ripple Effect in Android.


Before following these steps you must have installed JDK 7.0 or above and Android 2.0 on your device or PC.

  • Create a New Project in Android Studio and name it .
  • The minimum API level should be set to 21 because of Ripple Effect and Animation works on and above the Lollipop version.
  • Select Blank Activity and name your layout XML name as activity_main, then click finish. Write the following code inside Drawable folder. go to res>Drawable right click on Drawable then new and hit Drawable resource file and name it ripple_effects.xml This touch feedback drawable may have multiple child layers, including a special mask layer which is not drawn to the screen. By specifying its android: id value as the mask, a single layer may be set as the mark from XML.

Material Design Ripple Effect
Write these code to ripple_effects.xml

Write the following code inside activity_main.xml.

Download source code



Leave A Reply

Your email address will not be published.