瀏覽代碼

Bug Fix #222 MULTI_PAGE_OVERLAP模式下设置item的缩放大于默认值才有效,小于0.85f没有效果

zhpanvip 2 年之前
父節點
當前提交
2d11b8f989

+ 4 - 2
app/src/main/java/com/example/zhpan/banner/fragment/OthersFragment.java

@@ -23,6 +23,7 @@ import com.zhpan.indicator.IndicatorView;
 import com.zhpan.indicator.base.IIndicator;
 import com.zhpan.indicator.enums.IndicatorSlideMode;
 
+import java.util.List;
 import java.util.Random;
 
 /**
@@ -168,8 +169,9 @@ public class OthersFragment extends BaseFragment implements View.OnClickListener
   }
 
   private void updateData() {
-    mViewPager.refreshData(getPicList(new Random().nextInt(5) - 1));
-    ToastUtils.showShort("size=" + mViewPager.getData().size());
+    List<Integer> picList = getPicList(new Random().nextInt(5) - 1);
+    ToastUtils.showShort("size=" +picList.size());
+    mViewPager.refreshData(picList);
   }
 
   @Override

+ 2 - 3
app/src/main/java/com/example/zhpan/banner/fragment/PageFragment.kt

@@ -56,7 +56,6 @@ class PageFragment : BaseFragment() {
         resources.getDimensionPixelOffset(dimen.dp_4),
         resources.getDimensionPixelOffset(dimen.dp_5)
       )
-        .setAutoPlay(false)
       setOnPageClickListener({ _: View, position: Int -> itemClick(position) }, true)
       setInterval(5000)
     }
@@ -126,9 +125,9 @@ class PageFragment : BaseFragment() {
   ) {
     mViewPager
       .setPageMargin(resources.getDimensionPixelOffset(dimen.dp_15))
-      // .setScrollDuration(800)
+      .setScrollDuration(800)
       .setRevealWidth(leftRevealWidth, rightRevealWidth)
-      .setPageStyle(pageStyle)
+      .setPageStyle(pageStyle,0.9f)
       .create(getPicList(4))
   }
 

+ 1 - 1
bannerview/src/main/java/com/zhpan/bannerview/transform/OverlapPageTransformer.kt

@@ -43,7 +43,7 @@ class OverlapPageTransformer(
     ) { "unSelectedItemAlpha value should be between 1.0 to 0.0" }
   }
 
-  private val scalingValue = 0.2f
+  private val scalingValue = 0.4f
 
   override fun transformPage(
     page: View,