Skip to content

Ripples

ZieIony edited this page May 7, 2015 · 1 revision

The touch ripple is a new, nice way of showing that a view was clicked. Basically it's an animated RippleDrawable object set as a background. What's important to know about ripples:

  • RippleDrawable is using the new render thread, which makes the animation smooth. It also means that it's impossible to backport ripples without any changes.
  • RippleDrawable uses setHospot - a new method for setting animation hotspot.
  • RippleDrawable is usually clipped to a shape of a view, but can also work in a borderless mode.

RippleDrawable sources can be found in Android repository:

http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/5.0.1_r1/android/graphics/drawable/RippleDrawable.java

To implement ripples you have to:

  • Copy RippleDrawable to your code.
  • Remove the parts using the new rendering thread.
  • Call setHotspot in your view.
Clone this wiki locally