Is there any way similar like using smoothScrollToPosition
with control over speed or the time it takes to scroll smoothly?
Now i am using below snippet to scrool to pos
int firstVisible = lv.getFirstVisiblePosition();
int lastVisible = lv.getLastVisiblePosition();
if (firstVisible > pos)
lv.smoothScrollToPosition(pos, pos - firstVisible - 2);
if (pos > lastVisible)
lv.smoothScrollToPosition(pos, pos + lastVisible + 3);
From this i modified to aabove snippet as below
int childheight = lv.getChildAt(firstVisible).getHeight();
if (firstVisible > pos)
lv.smoothScrollBy(childheight*pos, 800);
if (pos > lastVisible)
lv.smoothScrollBy(childheight*pos, 1200);
But, i get nullpointer exceptions at
int childheight = lv.getChildAt(firstVisible).getHeight();
Edit
i am in need of scrooling automatically to a childView by a button press by user,say MENU button. I am not facing the problem of list scrolling slowly because of doing resource intensive task to populate listview. All i want is the functionality of smoothScrollToPosition
with smoothscrooltoPosition with velocity control