0

RealmRecyclerView より多くのデータを一番下ではなく一番上にロードしたい RealmRecyclerView のデフォルトのロードを一番上に設定する方法。

4

1 に答える 1

1

RecyclerView で上にスワイプしてより多くのデータを読み込みたい場合は、SwipeRefreshLayoutが適していると思います。実装は非常に簡単で、ローダーを使用したスワイプで効率的なコールバックを提供します。以下のコードを参考にしてください。

<android.support.v4.widget.SwipeRefreshLayout
            android:id="@+id/swipeRefreshLayout"
            android:layout_width="match_parent"
            android:layout_height="match_parent>

            <android.support.v7.widget.RecyclerView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:overScrollMode="never" />
        </android.support.v4.widget.SwipeRefreshLayout>

コールバック方法:

 swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            // Refresh items
        }
    });

これがあなたを助けることを願っています。

于 2017-02-21T14:19:01.477 に答える