zoukankan      html  css  js  c++  java
  • 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);
    }
    });




  • 相关阅读:
    F. 数学上来先打表
    LibreOJ β Round #2
    noip飞扬的小鸟
    jxoi2017
    分块算法
    Chino的数列
    cf 613E
    cf 126D
    cf 542E
    cf 512D
  • 原文地址:https://www.cnblogs.com/apeandcat/p/8390660.html
Copyright © 2011-2022 走看看