title: How to implement pagination in RecyclerView which is inside nestedScrollView
body: <p>I have included <code>RecyclerView</code> inside <code>NestedScrollView</code> and set</p>
  
  <p><code>mRecyclerView.setNestedScrollingEnabled(false);</code></p>
  
  <p>Since the scrolling of <code>RecyclerView</code> is set to <em>false</em>, I will not get the scroll position of <code>RecyclerView</code> due to this I will not be able to put pagination in <code>RecyclerView</code>.</p>
  
  <p>I have also tried this </p>
  
  <pre><code>   mRecylerview.addOnScrollListener(new RecyclerView.OnScrollListener() {
  
          @Override
          public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
              super.onScrollStateChanged(recyclerView, newState);
          }
  
  
          @Override
          public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
  
              if(dy &gt; 0) {
                  totalItemCount = linearLayoutManager.getItemCount();
                  lastVisibleItem = linearLayoutManager.findLastVisibleItemPosition();
                  if (!isLoading &amp;&amp; totalItemCount &lt;= (lastVisibleItem + visibleThreshold)) {
                      // End has been reached
                      // Do something
                      if (mOnLoadMoreListener != null) {
                          mOnLoadMoreListener.onLoadMore();
                          isLoading = true;
                      }
  
                  }
              }
          }
      });
  </code></pre>
  
  <p>But here <strong>lastVisibleItem</strong> always gives the length of the list to be displayed. </p>
  
  <p>After few digging, I found that when we use <code>RecylerView</code> inside <code>NestedScrollView</code> all the view gets created at the very beginning so that's the reason why  <em>lastVisibleItem</em> always gives the size of the list.</p>
  
  <p>Or if I am wrong please explain, me how <code>RecyclerView</code> inside <code>NestedScrollView</code> works?.</p>
  
  <p>Is there any workaround so that I can get <code>RecyclerView</code> scroll position so that I can make my pagination work?.</p>
  
  <p>It will be a great help. Thanks in advance</p>