I try to implement load more when scroll to bottom of recyclerView It's work when my XML only have recyclerView but when i put it to scrollview and setNestedScrollingEnabled(false) it doesn't work
" Requirement "
- The orange area is static layout
- The green area is dynamic items
and when i scoll to bottom orange area must be scroll down too
mAdapter = new RecyclerViewCommentAdapter(commentList, userInformationList);
mRecyclerViewComment = (RecyclerView) rootView.findViewById(R.id.recyclerViewComment);
mRecyclerViewComment.setNestedScrollingEnabled(false);
mRecyclerViewComment.setHasFixedSize(true);
mRecyclerViewComment.setItemViewCacheSize(30);
mRecyclerViewComment.setDrawingCacheEnabled(true);
mRecyclerViewComment.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_HIGH);
mLayoutManager = new LinearLayoutManager(mContext);
mRecyclerViewComment.setLayoutManager(mLayoutManager);
mRecyclerViewComment.setItemAnimator(new DefaultItemAnimator());
mRecyclerViewComment.setAdapter(mAdapter);
// Scroll //
mRecyclerViewComment.addOnScrollListener(new RecyclerView.OnScrollListener()
{
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy)
{
Log.d(getClass().getName(), "dy = " + dy);
if(dy > 0) //check for scroll down
{
visibleItemCount = mLayoutManager.getChildCount();
totalItemCount = mLayoutManager.getItemCount();
pastVisiblesItems = mLayoutManager.findFirstVisibleItemPosition();
Log.d(getClass().getName(), "totalItemCount = " + totalItemCount);
if (loading)
{
if ( (visibleItemCount + pastVisiblesItems) >= totalItemCount && (visibleItemCount + pastVisiblesItems) >= TOTAL_FIRST_LOAD)
{
loading = false;
loadMoreKey();
}
}
}
}
});
}
I try to debug 'dy' it's always 0