0

I have a RecyclerView with an ImageButton and a TextView. I implemented swiping with ItemTouchHelper.Callback: the TextView is moved to the right and the ImageButton is flipped, showing a bin icon.

I want to be able to click on the ImageView in order to confirm the removal of the element, but then the ViewHolder comes back to its idle state.

I think it is because RecyclerView captures the touchEvent and it does not reach the onClickListener in the button. Any ideas?

rea104
  • 1
  • 4
  • Add a `log` statement to the callback and see if in fact the button press is being captured. At this point we know as much as you do. – otoomey Nov 18 '17 at 16:35
  • No, the onClickListener of the button it is not captured, because the ItemTouchHelper intercepts the touchEvent and resets the viewHolder to its original position. – rea104 Nov 18 '17 at 19:12
  • Then this seems to be the thing you're looking for: https://developer.android.com/reference/android/support/v7/widget/helper/ItemTouchHelper.SimpleCallback.html – otoomey Nov 18 '17 at 20:50
  • Hy @user2776742, did you solve it? – Sharas May 01 '19 at 06:27

0 Answers0