0

I want to scroll a list view by x pixels

list.scrollListBy(x) works, but the default scrolling animations are missing

Is there any api to scroll list with animation,

I cannot use smoothScrollBy and its other varients, because it wont scroll if the element is already visible.

nmxprime
  • 1,506
  • 3
  • 25
  • 52
  • have you any example of what you whan..??? – Nils Dec 21 '15 at 13:21
  • Possible duplicate of [Scroll a ListView by pixels in Android](http://stackoverflow.com/questions/2375084/scroll-a-listview-by-pixels-in-android) – MSpeed Dec 21 '15 at 14:51
  • Possible duplicate of [(Smooth)ScrollToPosition doesn't work properly with RecyclerView](https://stackoverflow.com/questions/30845742/smoothscrolltoposition-doesnt-work-properly-with-recyclerview) – Pablo Cegarra Jun 19 '17 at 11:30

1 Answers1

-1

If you are using RecyclerView, you can call the method

list.scrollToPosition(int position)

to scroll to a particular position on the list. Let's say there are 50 positions on the list, and your phone screen is showing first 10 positions of the list. Then you can call

list.scrollToPosition(40);

to scroll to the 40th position. There will be a slightly smooth effect.

capt.swag
  • 10,335
  • 2
  • 41
  • 41