ZieIony/Carbon

How to change rippleColor progamatically

burhankhanzada opened this issue · 4 comments

I have frame layout which i using as card view i want to know how to change ripple color to primary color programmatically

ripple = RippleDrawable.create(ColorStateList.valueOf(color), [other params])
frameLayout.setRippleDrawable(ripple);

what arguments should i provide to view and radius for over ripple effect

View should always be the owner of this ripple - frameLayout in your case. Radius can be -1 to be computed automatically from its bounds. To get 'over' ripple you need to pass RippleDrawable.Style.Over as style. So:

ripple = RippleDrawable.create(ColorStateList.valueOf(color), RippleDrawable.Style.Over, frameLayout, true, -1)
frameLayout.setRippleDrawable(ripple);

thanks its working