title: GridView onTouch
body: <p>I am trying to set up a GridView of buttons that responds to onTouch.  For example, if I swipe my finger across the screen horizontally, vertically or diagonally then I want the buttons which were touched to be selected.  I tried setting OnTouchListener's for the buttons, but this didn't work, only the first button in the drag event received the onTouch events.  </p>
  
  <p>Next I tried creating an OnTouchListener for the GridView and then using the X,Y coords to determine which buttons where touched.  This doesn't seem to work either since the MOTION_DOWN events are only passed to the GridView's onTouch() if I start the drag on the very edge of the GridView.  In fact if I drag my finger horizontally across the grid, the onTouch events aren't fired at all unless I start the drag at the edge of the GridView.  Does anyone know of a better way to do this?</p>
  
  <p>Thanks in advance.</p>
  
  <pre><code>gridview.setOnTouchListener(new View.OnTouchListener()
  {
   @Override
   public boolean onTouch(@SuppressWarnings("unused") View view, MotionEvent event)
   {
    float X = event.getX();
    float Y = event.getY();
  
    switch (event.getAction()) { 
    case MotionEvent.ACTION_DOWN:
     System.out.println("Down: " + X + "," + Y);
     break;
    case MotionEvent.ACTION_MOVE:
     System.out.println("Move: " + X + "," + Y);
     break;
    case MotionEvent.ACTION_UP: 
     System.out.println("Up: " + X + "," + Y);
     break; 
    }
  
    return true;
   }
  }
  </code></pre>