title: I have to click twice to make it work, scroll or click event
body: <p>I have a viewPager that has 6 pages and in each page there is a <code>PullToRefreshGridView</code>. 
  I found that I have to click twice to triggered the click event or scroll the GridView.
  The first click didn't triggered the click event.
  These 6 pages have the same situation.</p>
  
  <p>Please can someone help me to debug and tell me what am I doing wrong here.</p>
  
  <p>This is my code:</p>
  
  <pre><code>viewPager = (ViewPager)findViewById(R.id.viewPager);
      adapterViewPager = new MyPagerAdapter(getSupportFragmentManager());
      viewPager.setAdapter(adapterViewPager);
      viewPager.setCurrentItem(0);
      viewPager.addOnPageChangeListener(this);
      viewPager.setOffscreenPageLimit(0);
  </code></pre>
  
  <p>and MyPagerAdapter is:</p>
  
  <pre><code>public static class MyPagerAdapter extends FragmentStatePagerAdapter {
      private static int NUM_ITEMS = 6;
  
          public MyPagerAdapter(FragmentManager fragmentManager) {
              super(fragmentManager);
          }
  
          @Override
          public void destroyItem(View collection, int position, Object o) {
              Log.d("DESTROY", "destroying view at position " + position);
              View view = (View) o;
              ((ViewPager) collection).removeView(view);
              view = null;
          }
  
          // Returns total number of pages
          @Override
          public int getCount() {
              return NUM_ITEMS; 
          }
  
          // Returns the fragment to display for that page
          @Override
          public Fragment getItem(int position) {
  
              switch (position) 
              {
              case 0:
                  return TypeZero.newInstance("", "Page # 1");
              case 1:
                  return TypeOne.newInstance("", "Page # 2");
              case 2:
                  return TypeTwo.newInstance("", "Page # 3");
              case 3:
                  return TypeThree.newInstance("", "Page # 4");
              case 4:
                  return TypeFour.newInstance("", "Page # 5");
              case 5:
                  return TypeFive.newInstance("", "Page # 6");
                  default:
                      return null;
              }
          }
  
          // Returns the page title for the top indicator
          @Override
          public CharSequence getPageTitle(int position) {
              switch(position)
              {
              case 0:
                  return "Zero";
              case 1:
                  return "One";
              case 2:
                  return "Two";
              case 3:
                  return "Three";
              case 4:
                  return "Four";
              case 5:
                  return "Five";
              default:
                  return null;
              }
          }
  </code></pre>
  
  <p>here is my layout activity_main.xml</p>
  
  <pre><code>&lt;RelativeLayout 
  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"
  tools:context=".MainActivity"&gt;
  
  &lt;android.support.v7.widget.Toolbar 
      android:id="@+id/toolbar"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_alignParentTop="true"
      android:background="#556fa5"
      android:minHeight="?attr/actionBarSize"&gt;
      &lt;/android.support.v7.widget.Toolbar&gt;
  
  
  &lt;android.support.v4.widget.DrawerLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/drawer_layout"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:layout_below="@+id/toolbar"&gt;
  
  
      &lt;RelativeLayout
          android:id="@+id/main_content"
          xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:app="http://schemas.android.com/apk/res-auto"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"&gt;
  
          &lt;android.support.design.widget.TabLayout
              android:id="@+id/tabLayout"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              app:tabIndicatorColor="#f44336"
              app:tabSelectedTextColor="#FFFFFF"
              app:tabTextColor="#03A9F4" /&gt;
  
          &lt;android.support.v4.view.ViewPager
              android:id="@+id/viewPager"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:layout_below="@id/tabLayout" /&gt;
  
      &lt;/RelativeLayout&gt;
  
      &lt;!-- Listview to display slider menu --&gt;
  
      &lt;ListView
          android:id="@+id/list_slidermenu"
          android:layout_width="240dp"
          android:layout_height="match_parent"
          android:layout_gravity="start"
          android:choiceMode="singleChoice"
          android:divider="@color/list_divider"
          android:dividerHeight="1dp"        
          android:listSelector="@drawable/list_selector"
          android:background="@color/list_background"/&gt;
  &lt;/android.support.v4.widget.DrawerLayout&gt;   
  </code></pre>
  
  <p></p>
  
  <p>The <code>PullToRefreshGridView</code> layout as below:</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:id="@+id/main_layout"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  tools:context="com.handmark.pulltorefresh.MainActivity" &gt;
  
  &lt;LinearLayout
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:gravity="center"
      android:orientation="vertical" &gt;
  
      &lt;!-- The PullToRefreshGridView replaces a standard GridView widget. --&gt;
  
      &lt;com.handmark.pulltorefresh.PullToRefreshGridView
          xmlns:ptr="http://schemas.android.com/apk/res-auto"
          android:id="@+id/pull_refresh_grid"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:paddingStart="5dp"
          android:paddingEnd="5dp"
          android:paddingTop="5dp"
          android:paddingBottom="5dp"
          android:columnWidth="0dp"
          android:gravity="center"
          android:layout_gravity="center"
          android:horizontalSpacing="10dp"
          android:verticalSpacing="10dp"
          android:numColumns="2"
          android:stretchMode="columnWidth"
          ptr:ptrDrawable="@drawable/ic_launcher"
          ptr:ptrMode="both" /&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p></p>