0
  1. RecyclerView uses ItemTouchHelper for swipe-to-dismiss
  2. ViewHolder contains nested horizontal RecyclerView
  3. Nested horizontal RecyclerView cannot be scrolled, instead whole ViewHolder gets swiped because ItemTouchHelper intercepts the swipe.

How do I make ItemTouchHelper ignore swipes on nested horizontal RecyclerView?

Sermilion
  • 1,920
  • 3
  • 35
  • 54
  • Hey are you saying that you want a horizontal recycler view in vertical recycler view ? – Arbaz Pirwani Aug 21 '19 at 04:27
  • I have a horizontal `RecyclerView` inside a `ViewHolder` which is in vertical `RecyclerView` already. So that nested horizontal RecyclerView cannot be scrolled, because `ItemTouchHelper` intercepts the swipe on it and swipes whole outer `ViewHolder`. – Sermilion Aug 21 '19 at 04:30
  • alright I think I have another opinion for you but first tell me about the data you are putting in recycler ? is that server data ? and also will you have more than one horizontal recycler in your item ? – Arbaz Pirwani Aug 21 '19 at 04:34
  • Yes, it is data from a server. Lets say, it is a list of articles. One item represents an article, the nested horizontal `RecyclerView` represents a list of tags related to that articles. There only gonna be one nested `RecyclerView` per item. – Sermilion Aug 21 '19 at 04:36
  • Oh... then you can just create what you have already created but I don't think it requires an ItemTouchHelper. you can simply create a xml file that contains full width and wrap height recycler and in your main adapter all your items have there adapter parent will be vertical and child will be horizontal. – Arbaz Pirwani Aug 21 '19 at 04:44
  • I think you still don't understand the problem correctly. I am using `ItemTouchHelper` for swipe-to-delete an item from my outer `RecyclerView`. Yes, If I don't user `ItemTouchHelper` nested `RecyclerView` scrolls fine, that's not the problem. But I do need swipe-to-delete behavior on the outer `RecyclerView`. – Sermilion Aug 21 '19 at 04:48
  • sorry :P but still swipe will be horizontal and also scroll is at the same position it will mess have you seen such interaction already somewhere ? – Arbaz Pirwani Aug 21 '19 at 04:57
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/198213/discussion-between-sermilion-and-arbaz-pirwani). – Sermilion Aug 21 '19 at 05:04

0 Answers0