Android Pie
Style RippleDrawable
Including file in your project
CompatRippleDrawble.java
Use static setup any View
Drawable drawable = new CompatRippleDrawable.Builder()
.setCornerRadius(/* Corner Radius */)
.setColor(/* Ripple Color */)
.setAlpha(/* Ripple Alpha */)
.build();
/* view */.setBackground(drawable);
@Override
public boolean onTouchEvent(MotionEvent event) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
/* drawable */.setHotspot(event.getX(), event.getY());
}
return super.onTouchEvent(event);
}
/* view */.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
/* drawable */.setHotspot(event.getX(), event.getY());
}
return false;
}
});