ViewPager 设定页面变化监听,用于在页面变换时请求服务器,更新页面
方法:
1 mViewPager.setOnPageChangeListener(new OnPageChangeListerer () { 2 3 @Override 4 public void onPageSelected(int position) { 5 mPagerList.get(position).initData(); 6 } 7 8 @Override 9 public void onPageScrolled(int position, float positionOffset, float positionOffsetPixels){ 10 11 } 12 13 @Override 14 public void onPageScrolledStateChanged(int state) { 15 16 } 17 18 }