Overlapping ItemDecorator
Recently i was working on a problem to achieve where one item in RecyclerView can overlap another item to achieve something like this :
Recently I was working on a problem to achieve where one item in RecyclerView can overlap with another thing to achieve something like this :
In this Ui, the Blue balloon is part of the Recyclerview item, but its look-alike has been added above on Recyclerview.
Lets Start :
class OverlappingItemDecoration : RecyclerView.ItemDecoration() {
override fun getItemOffsets(outRect: Rect, view: View, parent: RecyclerView, state: RecyclerView.State) {
if (parent.getChildAdapterPosition(view) != RecyclerView.NO_POSITION) {
outRect.set(0, 0, 0, - 60)
}
}
}
Dev Dhar
Hey , Please support me if you like my blogwww.buymeacoffee.com
It’s Done.
Please don’t forget to Clap :)
Please upvote my answer on Stackover Flow .