diff --git a/libs/android-support-v4.jar b/libs/android-support-v4.jar deleted file mode 100644 index 65ebaf8..0000000 Binary files a/libs/android-support-v4.jar and /dev/null differ diff --git a/src/cn/trinea/android/demo/AutoScrollViewPagerDemo.java b/src/cn/trinea/android/demo/AutoScrollViewPagerDemo.java index e076d31..0a1fe69 100644 --- a/src/cn/trinea/android/demo/AutoScrollViewPagerDemo.java +++ b/src/cn/trinea/android/demo/AutoScrollViewPagerDemo.java @@ -42,6 +42,7 @@ public void onCreate(Bundle savedInstanceState) { viewPager.setInterval(2000); viewPager.startAutoScroll(); + viewPager.setCurrentItem(Integer.MAX_VALUE / 2 - Integer.MAX_VALUE / 2 % imageIdList.size()); // the more properties whose you can set // // set whether stop auto scroll when touching, default is true diff --git a/src/cn/trinea/android/demo/adapter/ImagePagerAdapter.java b/src/cn/trinea/android/demo/adapter/ImagePagerAdapter.java index 9a44fb8..4204e7b 100644 --- a/src/cn/trinea/android/demo/adapter/ImagePagerAdapter.java +++ b/src/cn/trinea/android/demo/adapter/ImagePagerAdapter.java @@ -25,14 +25,17 @@ public class ImagePagerAdapter extends PagerAdapter { private Context context; private List imageIdList; + private int size; + public ImagePagerAdapter(Context context, List imageIdList) { this.context = context; this.imageIdList = imageIdList; + this.size = ListUtils.getSize(imageIdList); } @Override public int getCount() { - return ListUtils.getSize(imageIdList); + return Integer.MAX_VALUE;// ListUtils.getSize(imageIdList); } @Override @@ -43,7 +46,7 @@ public boolean isViewFromObject(View view, Object object) { @Override public Object instantiateItem(ViewGroup container, int position) { ImageView imageView = new ImageView(context); - imageView.setImageResource(imageIdList.get(position)); + imageView.setImageResource(imageIdList.get(position % size)); ((ViewPager)container).addView(imageView, 0); return imageView; }