smoothScrollToPosition Not Working-Android GridView -
i have gridview 10 rows , 10 columns.when activity starts gridview scroll last position can select item last row after selecting item last row scroll second last row..etc.but smoothscrolltoposition not working(just bounce time time) have done gridview.smoothscrollby(-63,1000) not getting result because scrolling has not uniform position every phones.so have getting uniform scrolling every phones.?
instead of using gv.smoothscrollby() try using gv.smoothscrollto() , mention specific position want show because scrollby scroll many pixels instead of pointing particular position.
and see, if values provided not in bounds of screen, start showing weird results, happens when trying out different device having different screen size , pixels mentioned doesn't exist in visible area. try using:
private int getvisiblearea() { int measurevalue = 0; switch (getresources().getdisplaymetrics().densitydpi) { case displaymetrics.density_medium: measurevalue =(screenheight); break; case displaymetrics.density_high: measurevalue = (screenheight); break; case displaymetrics.density_xhigh: measurevalue = (screenheight); break; } return measurevalue; } where screenheight is:
display display = getwindowmanager().getdefaultdisplay(); screenheight = display.getheight();
Comments
Post a Comment