diff --git a/autoScrollViewPager/src/main/java/com/kcode/autoscrollviewpager/view/BaseViewPagerAdapter.java b/autoScrollViewPager/src/main/java/com/kcode/autoscrollviewpager/view/BaseViewPagerAdapter.java index 2ea2aff..5ae0ce2 100644 --- a/autoScrollViewPager/src/main/java/com/kcode/autoscrollviewpager/view/BaseViewPagerAdapter.java +++ b/autoScrollViewPager/src/main/java/com/kcode/autoscrollviewpager/view/BaseViewPagerAdapter.java @@ -77,6 +77,19 @@ public void add(T t){ mView.updatePointView(getRealCount()); } + public void add(List list){ + if (data == null) { + data = new ArrayList<>(); + } + + data.addAll(list); + //设置初始为中间,这样一开始就能够往左滑动了 + mView.setCurrentItem(0); + + mView.start(); + mView.updatePointView(getRealCount()); + } + @Override public int getCount() { return data == null ? 0 : Integer.MAX_VALUE;