PullToRefleshListView请求网络数据后,不呈现?

我想用PullToRefleshListView的下拉功能,却发现获取到了数据,用listView经过同样的步骤,是可以呈现数据,但是PullToRefleshListView却没有。贴一下代码,求帮助。

布局文件:

<com.handmark.pulltorefresh.library.PullToRefreshListView
        xmlns:ptr="http://schemas.android.com/apk/res-auto"
        android:id="@+id/recommendList"
        ptr:ptrAnimationStyle="flip"
        ptr:ptrHeaderBackground="@color/backgroundGray"
        ptr:ptrHeaderTextColor="@color/littleGray"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/backgroundGray"
        android:dividerHeight="3dp">
    </com.handmark.pulltorefresh.library.PullToRefreshListView >
    

实现代码:

 PullToRefreshListView  recommendlist = (PullToRefreshListView) view.findViewById(R.id.recommendList);
            recommendlist.setMode(PullToRefreshBase.Mode.PULL_FROM_START);
            recommendlist.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener<ListView>() {
               @Override
               public void onRefresh(PullToRefreshBase<ListView> refreshView) {
                   getRecommendListData();
               }
            });
            
private void getRecommendListData(){

        progressManager.showProgress();

        dataList = null;

        //请求url
        String urlString = "http://。。。。。。;

        request = new StringRequest(Request.Method.GET, urlString, new Response.Listener<String>() {
            @Override
            public void onResponse(String response) {
                System.out.println(response);
                String recomendListName = String.format("recommendListData_%s.txt", cityId);

                //将内容保存起来
                FileManager fileManager = new FileManager(getContext(), recomendListName);
                fileManager.writeInFile(response);

                handleAdpater(response);

                if (recommendlist.isRefreshing()){
                    recommendlist.onRefreshComplete();
                }
                progressManager.hideProgress();
            }
        }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError volleyError) {
                System.out.println(volleyError);
                progressManager.hideProgress();
                recommendlist.onRefreshComplete();
                Toast.makeText(getContext(),"请检查网络",Toast.LENGTH_SHORT).show();
            }
        });
        FFApplication.getInstance().getNetQueue().add(request);
    }
    
    private void handleAdpater(String response){

    Gson gson = new Gson();
    RecommendListDataResult recommendListDataResult = gson.fromJson(response,RecommendListDataResult.class);

    //将数据赋值给
    this.dataList = recommendListDataResult.getData();

    RecommendListAdpater adpater = new RecommendListAdpater(dataList,getActivity());
    recommendlist.setAdapter(adpater);

    if (dataList != null){
        recommendlist.setClickable(true);
        recommendlist.setOnItemClickListener(this);
    }
}

打印出来都是有数据的,可是就是PullToRefleshListView没有显示任何内容,求大神帮忙

查看回复