android pull-up load more show all data solutions

Keywords: Android xml encoding

When I use the BaseQuickAdapter universal adapter to pull up and load more data, no matter whether I slide the interface or not, the pull-down loading has been loading more data, which does not meet the requirements of pulling down and starting to load more data at last.
No more nonsense, layout:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:orientation="vertical"
              android:layout_width="match_parent"
              android:layout_height="match_parent">
    <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
            android:id="@+id/homeswipe"
            android:layout_width="match_parent"
            android:layout_height="match_parent">
    <ScrollView android:layout_width="match_parent"
                android:layout_height="wrap_content"

    >
        <RelativeLayout
                android:descendantFocusability="blocksDescendants"
               
                android:layout_width="match_parent"
                android:layout_height="wrap_content">
    <com.youth.banner.Banner
            android:id="@+id/banner"
            android:layout_width="match_parent"
            android:layout_height="200dp" />


    <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/home_recyc"
            android:layout_below="@+id/banner"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

    </androidx.recyclerview.widget.RecyclerView>
        </RelativeLayout>
</ScrollView>
    </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</LinearLayout>

Here is my interface layout, scrollview nested carousel and recyclerview

Causes:

scrollview nesting recyclerview will always use the onCreateViewHolder() method when pulling up and loading more data. scrollview nesting recyclerview will load all the data at once, leading to the current problem.

resolvent:

We can use the add header provided by BaseQuickAdapter to define banner into a new layout, so that we can not use scrollview. The simplest thing is that you can delete scrollview directly, but it will lead to a bad interface.

Posted by Jocke on Mon, 28 Oct 2019 12:32:04 -0700