美文网首页
RecyclerView滑动到底部的判断

RecyclerView滑动到底部的判断

作者: 程序猿峰岑 | 来源:发表于2018-11-26 12:46 被阅读0次

public boolean isVisBottom(RecyclerView recyclerView) {

LinearLayoutManager layoutManager = (LinearLayoutManager) recyclerView.getLayoutManager();

    int lastVisibleItemPosition = layoutManager.findLastVisibleItemPosition();

    int visibleItemCount = layoutManager.getChildCount();

    int totalItemCount = layoutManager.getItemCount();

    int state = recyclerView.getScrollState();

    if (visibleItemCount >0 && lastVisibleItemPosition == totalItemCount -1 && state == recyclerView.SCROLL_STATE_IDLE) {

return true;

    }else {

return false;

    }

}

相关文章

网友评论

      本文标题:RecyclerView滑动到底部的判断

      本文链接:https://www.haomeiwen.com/subject/nhfbqqtx.html