diff --git a/library/src/main/java/com/daimajia/slider/library/SliderLayout.java b/library/src/main/java/com/daimajia/slider/library/SliderLayout.java index 149f36b..c201e79 100644 --- a/library/src/main/java/com/daimajia/slider/library/SliderLayout.java +++ b/library/src/main/java/com/daimajia/slider/library/SliderLayout.java @@ -625,6 +625,7 @@ public void removeSliderAt(int position){ if(getRealAdapter()!=null){ getRealAdapter().removeSliderAt(position); mViewPager.setCurrentItem(mViewPager.getCurrentItem(),false); + mViewPager.setAdapter(getWrapperAdapter()); } } @@ -638,6 +639,7 @@ public void removeAllSliders(){ //a small bug, but fixed by this trick. //bug: when remove adapter's all the sliders.some caching slider still alive. mViewPager.setCurrentItem(mViewPager.getCurrentItem() + count,false); + mViewPager.setAdapter(getWrapperAdapter()); } }