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;