I have implemented a swipeable recyclerview for editing purpose. Since the cardview contains a seekbar, it conflicts with the swipe. I overcame this problem using a button in toolbar menu, pressing the button once attaches the itemtouchhelper to the recyclerview (itemtouchhelper.attachToRecyclerView(recyclerView))
, thereby enabling swipe for editing and after that pressing the same button again, I am attaching it to null which disables the swipe.
itemtouchhelper.attachToRecyclerView(null)
.
Everything works as expected but I was concerned whether I did the right thing or is there any other method I should follow? Any help in form of guide or answer on whether my method is right or wrong would be appreciated
Thanks in Advance
Asked
Active
Viewed 223 times
1

Jubin Justifies
- 397
- 4
- 12

Samuel John
- 15
- 4
-
Use nestedscrollview and then define a layout under it and then put recycler view in it. It will work fine.. – Dec 20 '19 at 05:02
-
Please, don't put recyclerview in scrollview, you break recycling then. – Bracadabra Dec 20 '19 at 05:24
-
Well, i don't want to disable the swipe entirely, just toggle it. When the user wants to edit the name in the cardview, the user can click on a toggle button and enable swipe mode, and once the user is done editing clicking the toggle button would disable the swipe. I have done that by attaching the itemtouchhelper to a recyclerview and then to null as mentioned in my post. It is working as i want it to and i was asking whether it is the right way to do it? – Samuel John Dec 21 '19 at 18:17