title: Scroll in gridView make view shake
body: <p>I have a layout (which extends a framelayout) with a gridview and an imageview.  I scroll through the layout with an onTouchListener,. In my Galaxy Nexus it works fine, but in AVD and other devices (Galaxy SII for example) the view shakes and I can't find out why.</p>
  
  <p>XML</p>
  
  <pre><code>&lt;paricio.toni.caththemole.MyFrameLayout
      android:id="@+id/campo"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:layout_below="@+id/zonaMarcador" &gt;
      &lt;ImageView
          android:id="@+id/fondo"
          android:layout_width="800dp"
          android:layout_height="800dp"
          android:contentDescription="@android:string/untitled"
          android:src="@drawable/terrenoarena" /&gt;
      &lt;GridView
          android:id="@+id/gridView1"
          android:layout_width="640dp"
          android:layout_height="640dp"
          android:layout_gravity="center"
          android:clickable="true"
          android:columnWidth="80dp"
          android:horizontalSpacing="0dp"
          android:numColumns="8"
          android:overScrollMode="never"
          android:scrollbars="none"
          android:stretchMode="columnWidth"
          android:verticalSpacing="0dp" &gt;
  
      &lt;/GridView&gt;
  </code></pre>
  
  <p>And setOnTouchListener code:</p>
  
  <pre><code>    gridview.setOnTouchListener(new OnTouchListener() { 
          public boolean onTouch(View v, MotionEvent event) {
              int desplazamiento[]={0,0};
              campo.getLocationOnScreen(desplazamiento);
              switch (event.getAction()) {
                  case MotionEvent.ACTION_DOWN:
                      mx = event.getX();
                      my = event.getY();
                      return false;
                  case MotionEvent.ACTION_MOVE:
                      curX = event.getX();
                      curY = event.getY();
                      campo.scrollBy((int) (mx - curX), (int) (my - curY));                 
                      mx = curX;
                      my = curY;
                      return false;
                  case MotionEvent.ACTION_UP:
                      curX = event.getX();
                      curY = event.getY();
                      campo.scrollBy((int) (mx - curX), (int) (my - curY));
                      return false;
              }
              return false;
          }
      });
  </code></pre>
  
  <p>MyFrameLayout is a FrameLayout extended to be bigger than the screen:</p>
  
  <pre><code>@Override
  protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
      super.onMeasure(0, 0);
  }
  </code></pre>
  
  <p>I can scroll an ImageView in AVD without shake, but if I move the image and gridview (instead of the frame) the views move differently (and wrong). I have tried many things but I can't avoid the shake. ¿Any idea?</p>
  
  <p>Thanks.</p>