How to implement left and right swipe to reveal buttons in recycler view?

987 Views Asked by At

I need to implement left and right buttons in recycler view. I need to have 3 buttons in left side and right side. Also when say bottons like Pin, Edit etc. Something like below images.

enter image description here enter image description here

I have implemented this using item decoration of recyclerview

val itemTouchHelper = ItemTouchHelper(swipeController)
    itemTouchHelper.attachToRecyclerView(recyclerView)

    recyclerView?.addItemDecoration(object : RecyclerView.ItemDecoration() {

        override fun onDraw(c: Canvas, parent: RecyclerView, state: RecyclerView.State) {
            swipeController.onDraw(c)
        }
    })

When I select favorite in a row that state needs to be saved and when I swipe that particular cell again it should be highlighted to show that it is selected. I am not able to implement this. Please let me know if there is some alternative solution to implement this.

Thanks

0

There are 0 best solutions below