zoukankan      html  css  js  c++  java
  • PullToRefreshListView

    @Override
        protected void onRefreshing(final boolean doScroll) {
            /**
             * If we're not showing the Refreshing view, or the list is empty, the
             * the header/footer views won't show so we use the normal method.
             */
            /*ListAdapter adapter = mRefreshableView.getAdapter();
            if (!mListViewExtrasEnabled || !getShowViewWhileRefreshing() || null == adapter || adapter.isEmpty()) {
                super.onRefreshing(doScroll);
                return;
            }*/
            super.onRefreshing(false);
            }
        }

    mPullRefreshListView.setRefreshing();如果adapter是里面的size是null 或者大小是0

    这个时候 setRefreshing是不会有效果的.需要将PullToRefreshListView上面代码注释掉

    还有如果在下拉到底部的时候如果需要切换下拉的模式

    需要 pull_to_ref_listview.onRefreshComplete();

    在setData之前,不然会一直加载状态

    private void setData(String ids) {
            List<Goods> list = getGoods(ids);
            if (list != null && list.size() > 0) {
                search_layout.setVisibility(View.VISIBLE);
                if (page == 1) {
                    adapter.updateRefrushData(list);
                } else {
                    adapter.updateMoreData(list);
                }
                int size = list.size();
                if (size < PAGE_SIZE) {
                    pull_to_ref_listview.setMode(Mode.PULL_FROM_START);
                } else {
                    pull_to_ref_listview.setMode(Mode.BOTH);
                }
    
            } else if (page == 1) {
                mLoadingHolder.showEmpty();
            } else {
                pull_to_ref_listview.setMode(Mode.PULL_FROM_START);
            }
    
        }
  • 相关阅读:
    Java运行环境(win10)
    maven封装jar包遇到的问题
    eclipse安装STS遇到的问题
    Redis IO多路复用的理解
    操作系统文章推荐
    jdk1.8新特性
    Maven笔记
    博主推荐
    MySQL文章推荐
    多线程文章推荐
  • 原文地址:https://www.cnblogs.com/mingfeng002/p/3380732.html
Copyright © 2011-2022 走看看