Native Shopify Mobile App with 20 new features
Kickstart your hyperlocal marketplace in Corona pandemic with a starter guide
Android App Development
iOS App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 18.104.22.168 release ready!
Owner and Founder. Opencart
Working with recycler view is pretty easy and has made android programming a bit easy, but then also you need to know how exactly to use this powerful tool as per your wish.
To make items of a recycler view swipeable in any direction the google developers had provided you the a utility called the ItemTouchHelper which itself extends RecyclerView.ItemDecoration Class, so this can be applied to any recycler view and exactly in your activity where you set the adapter of your recycler view or any where in your activity and not in the adapter class of your recycler view.
With the introduction of this utility making the views of the recycler view swipeable has become very easy. In order to use this utility you first need to create a callback to this utility itself in which you need to override two basic methods of the callback class (namely onMove and onSwiped) plus another method (namely onChildDraw) if you wish to draw any child (or say paint the background to red) when any item is swiped.
Lets now have a look at the code :
Explanation : this piece of code allows you to add a callback if your item is swiped in the left direction.
With this being done you are all set to go, now you just have to attach this callback to a new ItemTouchHelper class object and associate this object with your recycler view and this is very easy .
Code to attach with recycler view :
And all is done, build your project and see how it looks 🙂
Keep coding and keep sharing 🙂
Your email address will not be published. Required fields are marked*
Save my name email and website in this browser for the next time I comment.
Excellent work, fast, good quality and understood the brief perfectly! Quick responses developing the project and very good cooperation. I suggest to anyone.
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.