Custom Ripple Effect on Android Button

It is a good user experience if we provide ripple effect whenever a user clicks on a button. It plays a wave color animation on the button and provides instant feedback to the user.

Default Ripple Effect

Setting a ripple effect on button is simple. All that you have to do is set two available default ripples on button in your app.

Creating Custom Ripple Effects

To change the color of ripple, we can create a custom ripple drawable for our project. We need to create different drawable xml files for bordered ripple and borderless ripple. This is how it can be done.

Bordered Ripple

Borderless Ripple

Borderless ripple has only ripple element inside drawable file. No mask is provided. 

In following example layout file, two buttons are provided, one with bordered ripple and one with borderless ripple.