From 644234d9646d6b9863b3aa37cc1bd64ffad326ea Mon Sep 17 00:00:00 2001 From: jdsjlzx <573842281@qq.com> Date: Tue, 21 Mar 2017 09:57:51 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E7=BC=BA=E5=B0=91=E5=BC=95?= =?UTF-8?q?=E5=8C=85=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/github/jdsjlzx/recyclerview/LRecyclerView.java | 7 ++++--- .../java/com/lzx/demo/ui/EndlessGridLayoutActivity.java | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/LRecyclerview_library/src/main/java/com/github/jdsjlzx/recyclerview/LRecyclerView.java b/LRecyclerview_library/src/main/java/com/github/jdsjlzx/recyclerview/LRecyclerView.java index 9137b07..d8fa169 100644 --- a/LRecyclerview_library/src/main/java/com/github/jdsjlzx/recyclerview/LRecyclerView.java +++ b/LRecyclerview_library/src/main/java/com/github/jdsjlzx/recyclerview/LRecyclerView.java @@ -12,6 +12,7 @@ import android.view.MotionEvent; import android.view.View; import android.view.ViewConfiguration; +import android.view.ViewGroup; import android.view.ViewParent; import com.github.jdsjlzx.interfaces.ILoadMoreFooter; @@ -371,9 +372,9 @@ public void setLoadMoreFooter(ILoadMoreFooter loadMoreFooter) { mFootView.setVisibility(GONE); //wxm:mFootView inflate的时候没有以RecyclerView为parent,所以要设置LayoutParams - ViewGroup.LayoutParams vlp = mFootView.getLayoutParams(); - if (vlp != null) { - mFootView.setLayoutParams(new LayoutParams(vlp)); + ViewGroup.LayoutParams layoutParams = mFootView.getLayoutParams(); + if (layoutParams != null) { + mFootView.setLayoutParams(new LayoutParams(layoutParams)); } else { mFootView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); } diff --git a/app/src/main/java/com/lzx/demo/ui/EndlessGridLayoutActivity.java b/app/src/main/java/com/lzx/demo/ui/EndlessGridLayoutActivity.java index 9b12a9b..d614f62 100644 --- a/app/src/main/java/com/lzx/demo/ui/EndlessGridLayoutActivity.java +++ b/app/src/main/java/com/lzx/demo/ui/EndlessGridLayoutActivity.java @@ -33,7 +33,7 @@ public class EndlessGridLayoutActivity extends AppCompatActivity { /**服务器端一共多少条数据*/ - private static final int TOTAL_COUNTER = 64; + private static final int TOTAL_COUNTER = 24; /**每一页展示多少条数据*/ private static final int REQUEST_COUNT = 10;