Android ViewPager Prev/Next Button

后端 未结 9 930
北荒
北荒 2020-12-08 04:00

Okay, so I\'m developing an Android app that utilises a ViewPager to display pages.

Within each page, I have a set of buttons to use for navigating between pages (in

9条回答
  •  我在风中等你
    2020-12-08 04:32

    public void onClick(View v) {
         int currentItem = mViewPager.getCurrentItem();
         mViewPager.setCurrentItem(currentItem+1); //(currentItem-1)
    }
    

    only this code in button click: @Override

    getcurrentitem is the actual item in viewpager, the next item is currentItem + 1

提交回复
热议问题