Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

列表数量不足一页,上拉加载也会被调用。 #36

Open
CrazySongCN opened this issue Dec 1, 2017 · 3 comments
Open

列表数量不足一页,上拉加载也会被调用。 #36

CrazySongCN opened this issue Dec 1, 2017 · 3 comments

Comments

@CrazySongCN
Copy link

首先感谢分享,我看别人提过这个问题,但是使用1.3.1版本,依然会出现。
代码如下:
mErlCoinExpire = (EasyRefreshLayout) findViewById(R.id.erl_coin_expire);
mErlCoinExpire.setRefreshHeadView(new SimpleRefreshHeaderView(CoinExpireActivity.this));
mErlCoinExpire.setLoadMoreView(new SimpleLoadMoreView(CoinExpireActivity.this));
mErlCoinExpire.addEasyEvent(new EasyRefreshLayout.EasyEvent() {
@OverRide
public void onLoadMore() {
getCoinExpire();
}

        @Override
        public void onRefreshing() {
            page=1;
            getCoinExpire();
        }
    });

暂时通过本地判断解决了,希望能改下

@dazeGitHub
Copy link

对,这个问题我也遇到了,刚开始就3条,当内部的 recyclerView 在刷新后 setNewData() 时会重新布局,导致 easyRefreshLayout 的 onLayout() 调用,如果当前界面的 item 数较少,则判断加载更多的 lastVisibleItem >= totalItemCount - 1 - advanceCount 条件就会成立,导致又会加载更多

@dazeGitHub
Copy link

这个设置个 boolean 值就行了,比如 mEnableLoadMore,刚开始 refresh 时设置为 false,然后在里边的 recyclerView 的滑动监听里加 && mEnableLoadMore,返回数据成功后再设置 mEnableLoadMore 为true,这样就可以了

@jingjc
Copy link

jingjc commented Apr 21, 2018

@dazeGitHub 大佬真厉害 我居然没想到 已经完美解决

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants