How to Implement Ripple Effect in Android
http://www.viralandroid.com/2015/10/how-to-implement-ripple-effect-animation-in-android.html
In this tip, I’m going to show you to implement ripple effect/animation in your android application. Now, you can easily add ripple effect/animation in your android, layouts, buttons, textviews, etc. and you can also change its color. Note that, this ripple effect will only show on device running lollipop and above.
Here, I have mentioned two different methods to implement ripple animation in your android application.
Related:
How to Add Ripple Effect/Animation to a Android Button
Android Floating Labels for EditText Using Design Support Library
Relative Layout - Views Position in Android
To implement effect on press/click just add android:background="?attr/selectableItemBackground" or android:background="?attr/selectableItemBackgroundBorderless" in android View or ViewGroup as background.
Using this method, you can customize ripple effect color. First, you have to create an xml file in your drawable resource directory. Create a ripple_effect.xml file and add following code.
res/drawable/ripple_effect.xml
And set background to above drawable resource file. Final code of xml layout activity looks like this.
res/layout/ripple_animation.xml
Here, I have mentioned two different methods to implement ripple animation in your android application.
Related:
How to Add Ripple Effect/Animation to a Android Button
Android Floating Labels for EditText Using Design Support Library
Relative Layout - Views Position in Android
Method 1 - To Implement Ripple Effect/Animation in Android
To implement effect on press/click just add android:background="?attr/selectableItemBackground" or android:background="?attr/selectableItemBackgroundBorderless" in android View or ViewGroup as background.
Method 2: To Implement Ripple Effect/Animation in Android
Using this method, you can customize ripple effect color. First, you have to create an xml file in your drawable resource directory. Create a ripple_effect.xml file and add following code.
res/drawable/ripple_effect.xml
And set background to above drawable resource file. Final code of xml layout activity looks like this.
res/layout/ripple_animation.xml