Touch Feedback helps add nice animation to signify view interactions like clicks and long clicks.
It can be implemented in the following ways
For simple bounded ripple effects on your view, set its background to
?android:attr/selectableItemBackground
For unbounded ripple effect, set the view’s background to
?android:attr/selectableItemBackgroundBorderless
The ripple effect extends beyond the originating view and ends at the bounds of its immediate non null parent.
This requires API >= 21.
3. Using a RippleDrawable. (Requires API >= 21)
A RippleDrawable can be used in two ways, xml and Java.
Before we proceed, it’s important to understand what a Mask is. A mask is a layer that defines the bounds of the ripple effect
The contentColor variable when set to null, gives the view the default background. To set the bounds of the ripple to that of the view, simply set the shapeDrawable variable to null.
Below is a clip showing the ripple effect generated from different implementations
{:refdef: style=“text-align: center;”}
![touch feedback]({{ site.url }}/assets/images/mask.gif)
{: refdef}