android – No ripples for MaterialCardView-ThrowExceptions

Exception or error:

Are there no ripples on the new MaterialCardView?

I used CardView with android:clickable="true" and android:foreground="?android:attr/selectableItemBackground" which worked fine but with the new MaterialCardView there are no ripples at all 😰.

Other Views etc. keep working but I want my card to be clickable (with ripple as feedback).

How to solve:

This is a bug with MaterialCardView. It’s overriding the foreground after it’s created. I’ve filled a bug. It should be fixed to show a ripple if the card is clickable without needing to set the foreground.

If you can’t wait for a fix you could use CardView from the support lib, or you could change your code to set the foreground drawable after the CardView has been inflated, or we would gladly accept a pull request! Relevant code at: It can probably use and a RippleDrawable for SDK >= 21.


In my case, It worked after adding android:clickable="true" and card_view:rippleColor="#cfd8dc" in XML file. Hope it will help to future SO.



Ripple effect is working now, but only if you add an OnClickListener on the CardView

Leave a Reply

Your email address will not be published. Required fields are marked *