-1

I want to slow the scrolling speed of smoothScrollToPosition that i have used with listview.

I need to slow the list after a button click

here is an sample of my Code:

`Handler handler = new Handler();
                    handler.postDelayed(new Runnable()
                    {
                        public void run()
                        {
                            systemApsLv.setVisibility(View.VISIBLE);
                            systemApsLv.post(new Runnable()
                            {
                                @Override
                                public void run()
                                {
                                    systemApsLv.smoothScrollToPosition(systemApsLv.getCount()-1);
//                        systemApsLv.setFriction(ViewConfiguration.getScrollFriction() * 1);
                                }
                            });}}`
  • Duplicate of https://stackoverflow.com/questions/32241948/how-can-i-control-the-scrolling-speed-of-recyclerview-smoothscrolltopositionpos – shubham vashisht Oct 18 '19 at 12:26
  • Possible duplicate of [How can i control the scrolling speed of recyclerView.smoothScrollToPosition(position)](https://stackoverflow.com/questions/32241948/how-can-i-control-the-scrolling-speed-of-recyclerview-smoothscrolltopositionpos) – Nick Reed Oct 18 '19 at 15:09

1 Answers1

0

Try this:

position: up to where you want to scroll

val layoutManager = LinearLayoutManager(baseContext, LinearLayoutManager.VERTICAL, false)
val smoothScroller = object : LinearSmoothScroller(context) {
        override fun getVerticalSnapPreference(): Int {
                return LinearSmoothScroller.SNAP_TO_START
      }
}
smoothScroller.targetPosition=position
layoutManager.startSmoothScroll(smoothScroller)
Subham Naik
  • 411
  • 5
  • 12