title: Getting scrollY atribute from an RecycleView with CardList inside a ViewPager adapter with SwipeToRefresh layout
body: <p>Ok, so i`m trying to get the scrollY atribute from my RecycleView (to see the position of where i am scrolling in the CardList. I have the following setup</p>
  
  <p>First, the main activity , which houses a SlidingTabs layout, which has a SwipeToFresh layout as he child and a ViewPager for the 2 fragments of the tabs, like this :</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:orientation="vertical"
  tools:context="com.example.popal.soul.MovieListActivity"&gt;
  
  &lt;com.example.popal.soul.SlidingTabLayout
  android:id="@+id/tabs"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:elevation="2dp"
  android:background="@color/ColorPrimary"/&gt;
  
  
  &lt;android.support.v4.widget.SwipeRefreshLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/swipeContainer"
      android:layout_width="match_parent"
      android:layout_height="match_parent"&gt;
  
      &lt;android.support.v4.view.ViewPager
          android:id="@+id/pager"
          android:layout_height="match_parent"
          android:layout_width="match_parent"
          android:layout_weight="1"&gt;
  
      &lt;/android.support.v4.view.ViewPager&gt;
  
  &lt;/android.support.v4.widget.SwipeRefreshLayout&gt;
  
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Then i have each fragment with an identical layout, like this, with an RecycleView :</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:paddingLeft="16dp"
  android:paddingRight="16dp"
  android:orientation="vertical"
  xmlns:android="http://schemas.android.com/apk/res/android"&gt;
  
      &lt;android.support.v7.widget.RecyclerView
          android:id="@+id/cardList"
          android:layout_width="match_parent"
          android:layout_height="match_parent" /&gt;
  
      &lt;ProgressBar
          android:id="@+id/progress_bar"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_centerInParent="true" /&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>And finally the layout for each card of the RecycleView (i don't think it matters, but i'll add it anyway)</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.v7.widget.CardView
  xmlns:card_view="http://schemas.android.com/apk/res-auto"
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/card_view"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  card_view:cardCornerRadius="4dp"
  android:layout_margin="5dp"&gt;
  
  &lt;RelativeLayout
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="?android:attr/selectableItemBackground"&gt;
      &lt;TextView
          android:id="@+id/title"
          android:layout_width="match_parent"
          android:layout_height="20dp"
          android:background="@color/bkg_card"
          android:text="Movie Title"
          android:gravity="center_vertical"
          android:textColor="@android:color/white"
          android:textSize="14dp"/&gt;
  
      &lt;ImageView
          android:elevation="5dp"
          android:scaleType="fitCenter"
          android:layout_width="100dp"
          android:layout_height="150dp"
          android:id="@+id/imageViewPoster"
          android:text="Poster"
          android:gravity="center_vertical"
          android:layout_below="@id/title"
          android:layout_marginTop="10dp"
          android:layout_marginLeft="5dp"/&gt;
  
      &lt;ImageView
          android:id="@+id/imageViewFanart"
          android:scaleType="fitCenter"
          android:layout_alignBottom="@+id/imageViewPoster"
          android:layout_toEndOf="@+id/imageViewPoster"
          android:layout_width= "235dp"
          android:layout_height="122dp"
          android:layout_marginRight="5dp"/&gt;
  
   &lt;/RelativeLayout&gt;
  
   &lt;/android.support.v7.widget.CardView&gt;
  </code></pre>
  
  <p>Now, i am trying to get the scrolling position of the RecycleView items from the main activity, where the SwipeToRefresh layout is defined. I need to do this to implement this workaround regarding a bug in the SwipeToRefresh layout, where trying to scroll up from the bottom of the list will trigger the refresh call : <a href="https://stackoverflow.com/questions/24658428/swiperefreshlayout-webview-when-scroll-position-is-at-top">SwipeRefreshLayout + WebView when scroll position is at top</a> , but as you can see, both solutions require access to the Swipe Container and RecycleView, in the same class or activity.</p>
  
  <p>I tried using something like  <code>int scrollY =  pager.getChildAt(pager.getCurrentItem()).getScrollY();</code></p>
  
  <p>Which should theoretically return the position of the child item (in this case, the RecycleView) , but it still returns 0 (added log entries to get real-time events when the scrolling state has change), like if was still returning the position of the ViewPage adapter.</p>
  
  <p>Anybody have an ideea?</p>