-3
  1. create a ripple.xml

  2. set the drawable to a ImageView

I found that the circle is draw outside current ImageView

How does this work

voiddog
  • 31
  • 5

2 Answers2

2

The reason is about hardware accelerate,see the function isProjected() in RippleDrawable.

If isProjected() return true, DislayList will hold this RenderNode (see http://androidxref.com/7.1.1_r6/xref/frameworks/base/libs/hwui/DisplayListCanvas.cpp#addRenderNodeOp)

voiddog
  • 31
  • 5
0

Easiest way- put the ImageView inside a larger layout, and apply the ripple to the layout.

Gabe Sechan
  • 90,003
  • 9
  • 87
  • 127
  • But how to apply the ripple to the parent layout? the `canvas` in `RippleDrawable` belone to `ImageView` – voiddog Aug 22 '17 at 04:41