Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scrollList does not work when listView.getCount()==1 #508

Open
GoogleCodeExporter opened this issue Aug 18, 2015 · 1 comment
Open

scrollList does not work when listView.getCount()==1 #508

GoogleCodeExporter opened this issue Aug 18, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

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 reported on code.google.com by [email protected] on 27 Aug 2013 at 1:26

@GoogleCodeExporter
Copy link
Author

Thanks for reporting this. Lets see what we can do. 

Original comment by [email protected] on 27 Aug 2013 at 3:01

  • Changed state: Accepted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant