From 097fefc956e79f29b48e77274d03185767b5b8f0 Mon Sep 17 00:00:00 2001 From: xuelang Date: Thu, 14 Jun 2018 10:46:14 +0800 Subject: [PATCH] Update SuperSwipeRefreshLayout.java MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 增加对4.4一下版本的兼容。 bug复现步骤: 1.删除掉RecyclerViewActivity 中onPullEnable(85行)中的代码 观察recyclerview的下拉刷新,会导致headerview覆盖recylerview --- .../com/github/nuptboyzhb/lib/SuperSwipeRefreshLayout.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/SuperSwipeRefreshLayout-Demo-AS/lib/src/main/java/com/github/nuptboyzhb/lib/SuperSwipeRefreshLayout.java b/SuperSwipeRefreshLayout-Demo-AS/lib/src/main/java/com/github/nuptboyzhb/lib/SuperSwipeRefreshLayout.java index 7c82577..b3ea4d4 100755 --- a/SuperSwipeRefreshLayout-Demo-AS/lib/src/main/java/com/github/nuptboyzhb/lib/SuperSwipeRefreshLayout.java +++ b/SuperSwipeRefreshLayout-Demo-AS/lib/src/main/java/com/github/nuptboyzhb/lib/SuperSwipeRefreshLayout.java @@ -37,6 +37,8 @@ import android.widget.RelativeLayout; import android.widget.ScrollView; +import static android.os.Build.VERSION_CODES.KITKAT; + /** * @Author Zheng Haibo * @PersonalWebsite http://www.mobctrl.net @@ -1125,7 +1127,9 @@ private void setTargetOffsetTopAndBottom(int offset, boolean requiresUpdate) { mHeadViewContainer.bringToFront(); mHeadViewContainer.offsetTopAndBottom(offset); mCurrentTargetOffsetTop = mHeadViewContainer.getTop(); - if (requiresUpdate && Build.VERSION.SDK_INT < 11) { + //针对4.4及之前版本的兼容 + if (requiresUpdate && Build.VERSION.SDK_INT < KITKAT) { + requestLayout(); invalidate(); } updateListenerCallBack();