Android ---------- 下拉刷新,上拉加载

Posted 程序猿的猫

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Android ---------- 下拉刷新,上拉加载相关的知识,希望对你有一定的参考价值。

视图布局部分:

<com.Widget.StateFrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
app:dataErrorLayoutResId="@layout/widget_dataerror"
app:emptyLayoutResId="@layout/widget_dataempty"
app:loadingLayoutResId="@layout/widget_data_loading"
app:needLoginLayoutResId="@layout/widget_needlogin"
app:netErrorLayoutResId="@layout/widget_neterror"
app:timeOutLayoutResId="@layout/widget_timeout"

>
<com.Widget.ASwipeRefreshLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
>
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</com.Widget.ASwipeRefreshLayout>

</com.Widget.StateFrameLayout>

控制器部分:
// 设置上拉加载更多
swipelayoutyoudan.setOnLoadMoreListener(new ASwipeRefreshLayout.OnLoadMoreListener() {
@Override
public void onLoadMore() {
pageindex+=1;
requestData(false);
}
});
//设置下拉刷新
swipelayoutyoudan.setOnRefreshListener(new ASwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
pageindex=1;
requestData(false);
}
});











































以上是关于Android ---------- 下拉刷新,上拉加载的主要内容,如果未能解决你的问题,请参考以下文章

Android实现RecyclerView的下拉刷新和上拉加载更多

xlistview上拉加载 下拉刷新

[Android实例] Android 6.0RecyclerView SwipeRefreshLayout 下拉刷新 上拉加载

Android ---------- 下拉刷新,上拉加载

RecyclerView 上拉加载下拉刷新

Android 控件smartRefeshLayout只要下拉刷新,禁止上拉加载