From 22af3ba50d2e5690f6efbf3c8d6ced517ebbb8e6 Mon Sep 17 00:00:00 2001 From: songwenchao <79556355@qq.com> Date: Mon, 21 May 2018 10:42:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- .../src/main/java/com/ms/banner/Banner.java | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index bf30200..72e04ce 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Gradle ```groovy dependencies{ - compile 'com.github.wenchaosong:banner:2.1.1' //最新版本 + compile 'com.github.wenchaosong:banner:2.1.2' //最新版本 } ``` 或者引用本地lib diff --git a/rollbanner/src/main/java/com/ms/banner/Banner.java b/rollbanner/src/main/java/com/ms/banner/Banner.java index 41a5a37..a30ae00 100644 --- a/rollbanner/src/main/java/com/ms/banner/Banner.java +++ b/rollbanner/src/main/java/com/ms/banner/Banner.java @@ -478,6 +478,25 @@ public void onPageScrollStateChanged(int state) { if (mOnPageChangeListener != null) { mOnPageChangeListener.onPageScrollStateChanged(state); } + + switch (state) { + case 0://No operation + if (currentItem == 0) { + viewPager.setCurrentItem(count, false); + } else if (currentItem == count + 1) { + viewPager.setCurrentItem(1, false); + } + break; + case 1://start Sliding + if (currentItem == count + 1) { + viewPager.setCurrentItem(1, false); + } else if (currentItem == 0) { + viewPager.setCurrentItem(count, false); + } + break; + case 2://end Sliding + break; + } } @Override