关于在PullToRefreshScrollView嵌套ListView的上拉加载

XMl布局文件

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:focusable="true"
    android:focusableInTouchMode="true"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    >
    <com.handmark.pulltorefresh.library.PullToRefreshScrollView
        xmlns:ptr="http://schemas.android.com/apk/res-auto"
        android:id="@+id/pull_refresh_scrollview"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        ptr:ptrAnimationStyle="flip"
        ptr:ptrMode="both" >
        <ScrollView
            android:id="@+id/my_scroll_view"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent" >
        <LinearLayout
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">



        <Spinner
            android:background="#ffffff"
            android:id="@+id/sp_company"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"/>
        <LinearLayout
            android:orientation="horizontal"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

        <Spinner
            android:layout_weight="1"
            android:background="#ffffff"
            android:layout_marginLeft="10dp"
            android:id="@+id/sp_company_supervision"
            android:layout_width="0dp"
            android:layout_height="match_parent"/>


        <Spinner
            android:layout_marginRight="10dp"
            android:layout_weight="1"
            android:background="#ffffff"
            android:layout_marginLeft="10dp"
            android:id="@+id/sp_company_construction"
            android:layout_width="0dp"
            android:layout_height="match_parent"/>

        </LinearLayout>

        <Spinner
            android:background="#ffffff"
            android:layout_marginLeft="10dp"
            android:id="@+id/sp_company_team"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"/>
         <LinearLayout
             android:layout_marginTop="10dp"
             android:gravity="center"
             android:orientation="horizontal"
             android:layout_width="match_parent"
             android:layout_height="wrap_content">
             <EditText
                 android:layout_marginLeft="10dp"
                 android:layout_weight="8"
                 android:singleLine="true"
                 android:hint="按姓名搜索"
                 android:background="#ffffff"
                 android:id="@+id/et_input_farmer_name"
                 android:layout_width="0dp"
                 android:layout_height="40dp" />
              <Button
                  android:textColor="#ffffff"
                  android:text="查询"
                  android:layout_marginRight="10dp"
                  android:layout_weight="2"
                  android:background="#04a3f2"
                  android:id="@+id/bt_input_farmer_name"
                  android:layout_width="0dp"
                  android:layout_height="40dp" />
         </LinearLayout>



        <Spinner
            android:background="#ffffff"
            android:layout_marginTop="10dp"
            android:layout_gravity="center_horizontal"
            android:id="@+id/sp_company_wage_years"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"/>

        <com.example.bing.workerwages.WholeLiistView
            android:id="@+id/gv_farmer_wages"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"

            />

        <com.example.bing.workerwages.WholeListView
        android:layout_marginTop="20dp"
        android:id="@+id/lv_wages_list"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        </com.example.bing.workerwages.WholeListView>

    </LinearLayout>
        </ScrollView>
    </com.handmark.pulltorefresh.library.PullToRefreshScrollView>
</LinearLayout>


代码片段

 pull_refresh_scrollview.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener2<ScrollView>() {
    @Override
    public void onPullDownToRefresh(PullToRefreshBase<ScrollView> refreshView) {

    }

    @Override
  public void onPullUpToRefresh(PullToRefreshBase<ScrollView> refreshView) {
        pull_refresh_scrollview.post(new Runnable() {

            @Override
            public void run() {

                fwl_page_index=""+fwl_page_index_int;
                farmer_wages_list_result="";
                init_farmer_wages_list();
                if (farmer_wages_list_result.contains("company_name")){
                fwl_page_index_int++;}

                
                pull_refresh_scrollview.onRefreshComplete();
                
            }
        });
    }
})

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值