Android recyclerView scrolls to the specified position just scrolls to and scrolls to the top

scroll to top 

           val layoutManager = mBinding.rvList.layoutManager as LinearLayoutManager
                    mBinding.rvList.postDelayed({
                        layoutManager.scrollToPositionWithOffset(index, 0)
                    }, 20)

scroll to just right

     mBinding.rvList.postDelayed({  mBinding.rvList.scrollToPosition(index)  }, 20)

Guess you like

Origin blog.csdn.net/mp624183768/article/details/131230642
Recommended