Description
From [email protected] on August 27, 2013 06:26:21
What steps will reproduce the problem? when i use scrollListToBottom ,the API does not work for me What is the expected output? What do you see instead? scroll the listview to bottom ,nothing happened What version of the product are you using? On what operating system? robotium 4.1 . Mac OSX 10.7.6
when i observe the source code ,i found that when listView.getCount==1 ,the scrollList will not work
see the source code here:
if (allTheWay) {
scrollListToLine(absListView, absListView.getCount() - 1);
return false;
}
if (absListView.getLastVisiblePosition() >= absListView.getCount() - 1) {
scrollListToLine(absListView,
absListView.getLastVisiblePosition());
return false;
}
if (absListView.getFirstVisiblePosition() != absListView
.getLastVisiblePosition())
scrollListToLine(absListView,
absListView.getLastVisiblePosition());
else
scrollListToLine(absListView,
absListView.getFirstVisiblePosition() + 1);
when getCount==1,then will goto scrollListToLine(absListView, 0),and will not scroll
m solution:add the following code
if(absListView.getCount() == 1){
absListView.smoothScrollToPosition(1);
}
then the listview can scroll to bottom
would you have some suggestions to deal with this situation??
wish your reply!!thank you!
Original issue: http://code.google.com/p/robotium/issues/detail?id=508