Android recyclerView: how to retain the selectableItemBackground to keep the row highlighted?

Viewed 34

I am successfully able to show a ripple effect on click of a recycler view item by setting this to the row:

android:clickable="true"
android:background="?attr/selectableItemBackground"
android:focusable="true"

When clicked, I am presenting a detail activity. How can I retain the ripple effect background when clicked? i.e. when a cell is clicked, the ripple animation occurs. I want the ripple to stay there after competition I manually remove it (when I return back to this activity). Sort of like keeping that row highlighted until I remove the highlight. How can I achieve this?

I tried setting focusableInTouchMode to true for the row and this does keep the row highlighted but then the onClick never gets called.

0 Answers
Related