Reputation: 6472
I have a RecyclerView (grid layout) whose elements are TextViews. When a user clicks on a TextView I change the color of the background. I allow for multiple selections. All of this works fine. Now I have a new requirement to show ripple when a user clicks on a TextView. So basically I must accomplish two things:
How do I accomplish this? I tried using android:drawSelectorOnTop="true”
in the RecyclerView (xml) but that made no difference.
So imagine I have to change the background of the TextView between blue and green. But on top I have to always show the ripple for the onLongClick
Upvotes: 0
Views: 782
Reputation: 8938
Assuming you are using the Android Support library change the android:background
of your item layout to ?attr/selectableItemBackground
or ?attr/selectableItemBackgroundBorderless
which will apply the ripple on Lollipop+ devices and fallback to a full item select on lower devices.
Upvotes: 1