android - Scrolling listview with buttons -
i want scroll listview pressing buttons. using 2 buttons , down , when press button listview should move 1 row , when press down button listview should move 1 row down.
my listview based on this link. found example of scrollview here. question instead of scrollview need use listview , should increase/decrease 1 row. new android me in solving issue. in advance.
you can try either of following:
for direct scroll:
getlistview().setselection(int);
for smooth scroll:
getlistview().smoothscrolltoposition(int);
sample code:
public view.onclicklistener onchk = new view.onclicklistener() { public void onclick(view v) { int index = list.getfirstvisibleposition(); getlistview().smoothscrolltoposition(index+1); // increment. } });
however need handle 1 case, if half or part of view @ top visible.
Comments
Post a Comment