Change Recyclerview Item Background When Swiped
Hi i am showing vertical list using recycler view and i am using a gradient background for recycler view.I am deleting items in recycler view when they are swiped left or right usi
Solution 1:
Perhaps you can try inside of onSelectedChanged()
. Alternatively, perhaps you can override clearView()
and do the change there after calling the superclass method.
EDIT
Having read the documentation more, I now think onSelectedChanged()
is the correct place to change the background both for when the item starts swiping and when it returns to idle. Check that the viewHolder
is not null and then check the actionState
for what to change the background to.
I think onChildDraw()
is not the right place to do this because it is already in the drawing phase and changing the view's background there will probably cause another re-draw.
Post a Comment for "Change Recyclerview Item Background When Swiped"