How to programmatically show next view in ViewPager?

前端 未结 4 1384

I created a ViewPager and everything is working fine, however I want to have a previous next button outside of ViewPager which can be used to navigate inside ViewPager. How can

4条回答
  •  生来不讨喜
    2021-02-01 00:52

    Easiest way is:

    nextButton.setOnClickListener { pager.arrowScroll(View.FOCUS_RIGHT) }
    prevButton.setOnClickListener { pager.arrowScroll(View.FOCUS_LEFT) }
    

提交回复
热议问题