RecrylerViewを使用して、SQLサーバーに保存されている曲の名前、曲の長さ、アーティストを表示しています。プルダウンリフレッシュを実装するにはどうすればよいですか?
回答:
回答№1は2プルダウンリフレッシュを実装するにはどうすればよいですか?
あなたは使うことができます android.support.v4.widget.SwipeRefreshLayout
レイアウトを内側に囲む 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:id="@+id/itemsRecyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical" />
</android.support.v4.widget.SwipeRefreshLayout>
Java
mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
// Refresh items
refreshItems();
}
});