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);

Manoj
  • 2,799
  • 5
  • 30
  • 49

1 Answers1

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).

Oleg Vaskevich
  • 12,444
  • 6
  • 63
  • 80