![](https://i-blog.csdnimg.cn/blog_migrate/1c8f599eef3b2fb692b2533b5caf4756.png)
![](https://i-blog.csdnimg.cn/blog_migrate/0a4acf0b1c72d827691f066ce6cd19b1.png)
ViewPager
ViewPager及ViewPager2
ublic class MyAdapter extends PagerAdapter {
public int getCount() {
return viewList .size();}
public boolean isViewFromObject(View view, Object object) {
return view==object; }
ViewPager常用方法
翻页监听接口 | ViewPager.OnPageChangeListener |
页面滑动状态停止前一直调用 | onPageScrolled(int position, float positionOffset, int positionOffsetPixels) |
滑动后显示的页面和滑动前不同,调用 | onPageSelected(int position) |
页面状态改变时调用 | onPageScrollStateChanged(int state) |