Android throbbing on CardView without launching onClick

I want to show the effect of ripple on my file cabinet and I know that this can be done as follows:

  android:foreground="?android:attr/selectableItemBackground"
android:clickable="true"

The problem is that my onclicklistener no longer recognizes clicks on my map. Without these two attributes, it works great. I also noticed that if I remove the clickable attribute, only the first card on my list gets a ripple effect, and it starts from the middle, and not from where I click. On other cards, you get only a dark background. Is there any solution for this problem?

+4
source share
1 answer

For me, I only have

android:foreground="?android:attr/selectableItemBackground"

not

android:clickable="true"

and it worked great with onclicklistener, from where the user clicked.

+1
source

All Articles