From 725bae9d408bcee69efbc990c0b6919c79a78695 Mon Sep 17 00:00:00 2001 From: Fitz Date: Wed, 2 Nov 2022 19:30:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=BB=98=E8=AE=A4=20gapStrat?= =?UTF-8?q?egy=3D=3DGAP=5FHANDLING=5FNONE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../flap/widget/FlapIndexedStaggeredGridLayoutManager.java | 4 +++- .../yifeiyuan/flap/widget/FlapStaggeredGridLayoutManager.kt | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/flap/src/main/java/me/yifeiyuan/flap/widget/FlapIndexedStaggeredGridLayoutManager.java b/flap/src/main/java/me/yifeiyuan/flap/widget/FlapIndexedStaggeredGridLayoutManager.java index 5fd0659e..7670907a 100644 --- a/flap/src/main/java/me/yifeiyuan/flap/widget/FlapIndexedStaggeredGridLayoutManager.java +++ b/flap/src/main/java/me/yifeiyuan/flap/widget/FlapIndexedStaggeredGridLayoutManager.java @@ -154,9 +154,11 @@ public class FlapIndexedStaggeredGridLayoutManager extends RecyclerView.LayoutMa FlapIndexedStaggeredGridLayoutManager.LazySpanLookup mLazySpanLookup = new FlapIndexedStaggeredGridLayoutManager.LazySpanLookup(); /** + * 修改:默认改为 GAP_HANDLING_NONE * how we handle gaps in UI. */ - private int mGapStrategy = GAP_HANDLING_MOVE_ITEMS_BETWEEN_SPANS; +// private int mGapStrategy = GAP_HANDLING_MOVE_ITEMS_BETWEEN_SPANS; + private int mGapStrategy = GAP_HANDLING_NONE; /** * Saved state needs this information to properly layout on restore. diff --git a/flap/src/main/java/me/yifeiyuan/flap/widget/FlapStaggeredGridLayoutManager.kt b/flap/src/main/java/me/yifeiyuan/flap/widget/FlapStaggeredGridLayoutManager.kt index 4741da30..e7a941aa 100644 --- a/flap/src/main/java/me/yifeiyuan/flap/widget/FlapStaggeredGridLayoutManager.kt +++ b/flap/src/main/java/me/yifeiyuan/flap/widget/FlapStaggeredGridLayoutManager.kt @@ -23,6 +23,10 @@ open class FlapStaggeredGridLayoutManager var supportsPredictiveItemAnimations = false + init { + gapStrategy = GAP_HANDLING_NONE + } + /** * Disable predictive animations. There is a bug in RecyclerView which causes views that * are being reloaded to pull invalid ViewHolders from the internal recycler stack if the