0

How move the first and the last element of RecyclerView to the center of the widget?

Example

1

I found next example: RecyclerView allow first/last items to be scrolled to the centre

But i can't describe this solution for my case. There is my code:

class CustomLinearLayoutManager(context: Context): LinearLayoutManager(context , LinearLayoutManager.HORIZONTAL, false) {
    override fun getPaddingStart(): Int {
        return width / 2
    }

    override fun getPaddingEnd(): Int {
        return paddingStart
    }
}

I feel that I have implemented incorrectly this solution

Please let me know how correctly to realize move outermost items to the center in horizontal RecyclerView widget.

vimuth
  • 5,064
  • 33
  • 79
  • 116
Vasily
  • 1
  • 1

0 Answers0