在最后一张图向右继续滑动时,跳转到第一张图片
picture_viewpager.setAdapter(new PagerAdapter() {
@Override
public int getCount() {
return pictureList.size();
}
@Override
public boolean isViewFromObject(View view, Object object) {
return view == object;
}
@Override
public Object instantiateItem(ViewGroup container, int position) {
container.addView(pictureList.get(position));
return pictureList.get(position);
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
container.removeView((View) object);
}
});
picture_viewpager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
if (position==5&&positionOffset==0)
{
picture_viewpager.setCurrentItem(1,false);
}
}
@Override
public void onPageSelected(int position) {
}
@Override
public void onPageScrollStateChanged(int state) {
}
});
程序运行时,每次都会停止工作,是不是跟viewpager只能缓存3个页面有关,还是其他什么原因,该怎么解决