我正在使用RecrylerView显示存储在SQL server中的歌曲名称,歌曲长度和Artist。如何实现下拉刷新?
答案 0 :(得分: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>
爪哇
mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
// Refresh items
refreshItems();
}
});