0

I am new to Android.How to use ViewPager.scrollBy(int x,int y)? ViewPager.scrollBy(int x,int y) is not updating View

new Handler().post(new Runnable() { @Override public void run() { // TODO Auto-generated method stub mainPager.scrollBy(10,0); } }); 

even this is not updating View. please tell me what is the difference between scrollTo(int x,int y) and scrollBy(int x,int y);

1 Answer 1

2

From what I understand scrollTo() and scrollBy() are not applicable to ViewPager; they're just methods defined by View that do not apply to ViewPager.

If you're trying to move to a specific page, use setCurrentItem(int item, boolean smoothScroll).

Sign up to request clarification or add additional context in comments.

1 Comment

Yes, but it's a bit of a hack. See my answer: stackoverflow.com/a/14179739/832776

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.