title: Android SwipeRefreshLayout how to implement canChildScrollUp if child is not a ListView or ScrollView
body: <p>Hi i have a SwipeRefreshLayout that contains a relative layout which contains a scroll view and another view currently when i scroll down the list sometimes wont scroll back up instead it runs the onRefresh function. How do i prevent it from running this unless the view is at the top? i had read about canChildScrollUp but not found a way to implement it correctly.</p>
  
  <p>heres my layout</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  
  &lt;android.support.v4.widget.SwipeRefreshLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/swipe_container"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      &gt;
  
      &lt;RelativeLayout 
          android:layout_width="match_parent"
          android:layout_height="match_parent"
           xmlns:app="http://schemas.android.com/apk/res-auto"
          &gt;
  
  &lt;ScrollView 
       android:layout_width="match_parent"
       android:layout_height="match_parent"
       android:scrollbars="none"&gt;
  
      &lt;RelativeLayout 
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:orientation="vertical" &gt;
  
  
  
          &lt;RelativeLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:id="@+id/profile"
              android:background="@drawable/homepage_image_1"&gt;        
  
               &lt;com.alldaypa.alldaypa.customviews.CircularImageView
  
                  android:layout_width="75dp"
                  android:layout_height="75dp"
                  app:border_color="#FFFFFF"
                  app:border_width="8dp"
                  app:shadow="false"
                  android:id="@+id/profile_image"
                  android:layout_alignParentTop="true"
                  android:layout_alignParentLeft="true"
                  android:layout_marginLeft="70dp"
                  android:layout_marginTop="20dp"
                  android:src="@drawable/homepage_noimage_male"
                  android:clickable="true"  /&gt;
  
             &lt;ImageView 
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:layout_alignBottom="@+id/profile_image"
                 android:layout_alignRight="@+id/profile_image"
                 android:src="@drawable/homepage_profile_add"
                 android:layout_marginRight="3dp"
                 android:layout_marginBottom="3dp"
             /&gt;
  
  
  
  
              &lt;TextView android:id="@+id/profile_name"
                  android:text="Name"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:textSize="20sp"
                  android:layout_alignTop="@+id/profile_image"
                  android:layout_toRightOf="@+id/profile_image"
                  android:layout_marginTop="20dp"
                  android:textColor="@color/darkgrey"
                  android:layout_marginLeft="10dp"/&gt;
  
              &lt;TextView android:id="@+id/company"
                  android:text="Company"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:textSize="16sp"
                  android:layout_below="@+id/profile_name"
                  android:layout_alignLeft="@+id/profile_name"
                  android:textColor="@color/darkgrey"
                  android:layout_marginTop="-2dp"/&gt;
  
  
          &lt;/RelativeLayout&gt;
  
              &lt;RelativeLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:id="@+id/availability"
              android:background="@color/white"
              android:padding="20dp"
              android:layout_below="@+id/profile"&gt;        
  
  
              &lt;TextView android:id="@+id/profile_status_title"
              android:text="Your current availability status:"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:textSize="14sp"
              android:layout_alignParentTop="true"
              android:layout_centerHorizontal="true"
              android:textColor="@color/darkgrey"/&gt;
  
              &lt;TextView android:id="@+id/profile_status"
              android:text="Available"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:textSize="32sp"
              android:layout_below="@+id/profile_status_title"
              android:layout_centerHorizontal="true"
              android:textColor="@color/green"
              android:layout_marginTop="-2dp"/&gt;
  
              &lt;TextView android:id="@+id/profile_status_reason"
              android:text="On: 01924 501370"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:textSize="24sp"
              android:layout_below="@+id/profile_status"
              android:layout_centerHorizontal="true"
              android:textColor="@color/pink"/&gt;
  
          &lt;/RelativeLayout&gt;
  
  
          &lt;TextView
          android:id="@+id/messages"
          android:layout_width="match_parent"
          android:layout_height="30dp"
          android:layout_alignParentRight="true"
          android:layout_below="@+id/availability"
          android:ellipsize="end"
          android:lines="1"
          android:background="@color/pink"
          android:textColor="@color/white"
          android:textSize="14sp" 
          android:paddingLeft="10dp"
          android:paddingTop="5dp"
          android:gravity="left"
          android:text="Messages" /&gt;
  
          &lt;RelativeLayout
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
              android:layout_below="@+id/messages"
              android:background="@color/midgrey"&gt;
  
               &lt;com.alldaypa.alldaypa.customviews.SwipeListView
                  xmlns:swipe="http://schemas.android.com/apk/res-auto"
                  android:id="@+id/list"
                  android:listSelector="#00000000"
                  android:layout_width="fill_parent"
                  android:layout_height="400dp"
                  swipe:swipeFrontView="@+id/front"
                  swipe:swipeBackView="@+id/back"
                  swipe:swipeActionLeft="reveal"
                  swipe:swipeMode="left"
                  swipe:swipeCloseAllItemsWhenMoveList="true"
                  swipe:swipeOpenOnLongPress="false"
                  swipe:swipeAnimationTime="0"
                  swipe:swipeOffsetLeft="200dp"
                  swipe:swipeOffsetRight="0dp"
                  android:focusable="false"
              /&gt;
  
  
                  &lt;ImageView android:layout_height="1dp"
                  android:layout_width="match_parent"
                  android:background="@color/searchbg"
                  android:layout_below="@+id/list"
                  android:layout_alignLeft="@+id/list"
                  android:id="@+id/line"
  
  
                  /&gt;
  
             &lt;Button
                  android:layout_width="match_parent"
                  android:layout_height="60dp"
                  android:background="@drawable/listitem"
                  android:textColor="@color/darkgrey"
                  android:textSize="18sp"
                  android:text="View all messages"
                  android:layout_below="@+id/line"
                  android:gravity="center"
                  android:layout_centerVertical="true"
                  android:id="@+id/viewall"
                  android:layout_centerHorizontal="true"
                /&gt;
  
          &lt;/RelativeLayout&gt;
  &lt;/RelativeLayout&gt;
  
  
  
  &lt;/ScrollView&gt;
  
  &lt;include  layout="@layout/elv_undo_popup" android:id="@+id/undo" android:visibility="gone"/&gt; 
  &lt;/RelativeLayout&gt;
  
  &lt;/android.support.v4.widget.SwipeRefreshLayout&gt;
  </code></pre>
  
  <p>and heres where i have implemented my class</p>
  
  <pre><code>swipeLayout = (SwipeRefreshLayout)v.findViewById(R.id.swipe_container);
          swipeLayout.setColorSchemeColors(Color.parseColor("#ed037c"), Color.parseColor("#c40053"),Color.parseColor("#ffffff"), Color.parseColor("#51af50"));
  
          swipeLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { 
              @Override public void onRefresh() { 
                  swipeLayout.setRefreshing(true);
                  Log.d("Swipe", "Refreshing Number"); 
                  ( new Handler()).postDelayed(new Runnable() { 
                      @Override public void run() { 
  
                          updateLocalData();
  
                      } 
                      }, 3000); 
                  }
              });
  </code></pre>