Material 设计涟漪事件

Material Design Ripple Event

对于 Android ,我需要在触摸任何 element/view 时实现动画波纹效果。我如何实现它?

波纹以可绘制对象的热点为中心,该热点在触摸按钮时设置。查看 Drawable.setHotspot(float x, float y)

根据 Android 文档:

Drawable that shows a ripple effect in response to state changes. The anchoring position of the ripple for a given state may be specified by calling setHotspot(float, float) with the corresponding state attribute identifier.

效果以setHotspot()方法指定的中心绘制