title: In nested recyclerview, child recyclerview's GridLayoutManager.getChildCount() gives total item count
body: <p>I am using a <code>RecyclerView</code> inside <code>SwipeRefreshLayout</code>.The <code>RecyclerView</code> has another 2 <code>RecyclerView</code> (for now; it may increase). In my second <code>RecyclerView</code> i am trying to implement infinite scrolling. But my <code>RecyclerView.getItemCount()</code> and <code>RecyclerView.getChildCount()</code> are giving same value. Also the 2nd re has <code>GridLayoutManager</code> and <code>GridlayoutManager.findFirstVisibleItemPosition()</code> always gives 0 and <code>GridLayoutManager.findLastVisibleItemPosition()</code> always gives list size - 1 in <code>OnScrolled</code> of the <code>RecyclerView</code>. What is causing this and what should i do to implement the infinite scrolling.</p>
  
  <p>fragment.xml</p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="utf-8"?&gt;
   &lt;android.support.v4.widget.SwipeRefreshLayout
  android:id="@+id/swipe_container"
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="match_parent"&gt;
  
  &lt;android.support.v7.widget.RecyclerView
      android:id="@+id/main_container"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:clipToPadding="false"
      android:paddingTop="@dimen/padding_standard"
      android:paddingBottom="@dimen/padding_standard"&gt;
  
  &lt;/android.support.v7.widget.RecyclerView&gt;
  &lt;/android.support.v4.widget.SwipeRefreshLayout&gt;
  </code></pre>
  
  <p>parent_recyclerview.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout    xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_marginBottom="@dimen/padding_standard"
  android:orientation="vertical"&gt;
  
  &lt;TextView
      android:id="@+id/section_label"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_marginLeft="@dimen/padding_standard"
      android:layout_marginBottom="@dimen/margin_standard"
      android:textColor="@color/label_text"
      android:textSize="@dimen/text_size_standard"
      android:textStyle="bold"
      tools:text="MOments"/&gt;
  
  &lt;android.support.v7.widget.RecyclerView
      android:id="@+id/section_list"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:clipToPadding="false"/&gt;
  
  &lt;ProgressBar
      android:id="@+id/events_progress"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_gravity="center_horizontal"
      android:visibility="gone"/&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>onScrollListener for child recycler view</p>
  
  <pre><code>  RecyclerView.OnScrollListener scrollListener = new RecyclerView.OnScrollListener() {
          @Override
          public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
              super.onScrolled(recyclerView, dx, dy);
              GridLayoutManager manager = (GridLayoutManager) recyclerView.getLayoutManager();
              int itemSize = manager.getItemCount();
              int firstVisibleItem = manager.findFirstVisibleItemPosition();
              int visibleChIldCount = manager.getChildCount();
              Logger.e(TAG,"=============== START =====================");
              Logger.e(TAG, "itemSize: " + itemSize);
              Logger.e(TAG, "firstVisibleitem: " + firstVisibleItem);
              Logger.e(TAG, "visibleChIldCount: " + visibleChIldCount);
              Logger.e(TAG,"mLayoutManager.firstCOmpletely: "+ manager.findFirstCompletelyVisibleItemPosition());
              Logger.e(TAG,"mLayoutManager. lastcompletey: "+ manager.findLastCompletelyVisibleItemPosition());
                  Logger.e(TAG,"mLayoutManager.findLastVisible: "+ manager.findLastVisibleItemPosition());
              Logger.e(TAG,"=================END ================");
              if (itemSize &gt;= firstVisibleItem + visibleChIldCount){
                  Logger.e("", "loading");
                      mLoadMoreListener.loadMore();
  
              } else {
                  Logger.e(TAG, "not Loading");
              }
          }
  };
  </code></pre>