title: OnTouchListener fires touch events for a view, but OnClickListener does not
body: <p>My situation is this: I have a small form which, when clicked, expands into a larger form.  I initially don't want any elements in the small form to be focused, so I create an invisible LinearLayout which takes focus when the Activity is created.  If I expand the small form into a larger form, one of the elements displayed is an ImageButton which I would like the user to be able to click.</p>
  
  <p>What's weird is that if I expand the form from a small form without focusing on one of the other elements, my ImageButton does not receive any Click events.  If I put an <code>OnClickListener</code> onto the <code>ImageButton</code> then what happens is that all of the clicks onto my button are batched up and then sent once an EditText in the form takes focus.  However, if I attach an <code>OnTouchListener</code> onto that <code>ImageButton</code>, then both the MOTION_UP and MOTION_DOWN events are received by the listener and can be acted on.</p>
  
  <p>The XML for my <code>ImageButton</code> is simply.</p>
  
  <pre><code>&lt;merge&gt;
  &lt;ImageButton
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_alignBottom="@+id/zip_code_edittext"
      android:layout_alignParentRight="true"
      android:layout_alignTop="@id/zip_code_edittext"
      android:background="@null"
      android:contentDescription="@string/select_country" /&gt;
  </code></pre>
  
  <p>I've tried setting <code>android:focusable</code> and <code>android:focusableInTouchMode</code> to no avail.  Any idea as to what could be happening here?</p>
  
  <p>The whole XML file (with a bunch of un-fun elements removed) is:</p>
  
  <pre><code>&lt;LinearLayout
      android:id="@+id/invisible"
      android:layout_width="0px"
      android:layout_height="0px"
      android:focusable="true"
      android:focusableInTouchMode="true"&gt;
  
      &lt;requestFocus /&gt;
  &lt;/LinearLayout&gt;
  
  &lt;LinearLayout
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:orientation="vertical"&gt;
  
      &lt;RelativeLayout
          android:id="@+id/top_rl"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_marginBottom="40dp"&gt;
  
          &lt;RelativeLayout
              android:id="@+id/second_rl"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"&gt;
  
              &lt;!-- A bunch of stuff unrelated to this particular situation --&gt;
  
          &lt;/RelativeLayout&gt;
  
          &lt;RelativeLayout
              android:id="@+id/photo_container"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_alignTop="@id/second_rl"
              android:layout_centerHorizontal="true"
              android:layout_marginTop="20dp"&gt;
  
           &lt;!-- A lot of things related to photos which are uninteresting for the purpose of this --&gt;
         &lt;/RelativeLayout&gt;
      &lt;/RelativeLayout&gt;
  
      &lt;LinearLayout
          android:id="@+id/bottom_items"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:animateLayoutChanges="true"
          android:orientation="vertical"&gt;
  
          &lt;LinearLayout
              android:id="@+id/small_form"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:orientation="vertical"&gt;
  
              &lt;LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:orientation="horizontal"&gt;
  
                  &lt;EditText
                      android:id="@+id/first_name"
                      android:layout_width="0dp"
                      android:layout_height="wrap_content"
                      android:layout_margin="?baseGapSize"
                      android:layout_weight="1"
                      android:hint="@string/first_name"
                      android:imeOptions="actionNext|flagNoExtractUi"
                      android:inputType="text|textCapSentences|textNoSuggestions"
                      android:nextFocusDown="@+id/last_name" /&gt;
  
                  &lt;EditText
                      android:id="@id/last_name"
                      android:layout_width="0dp"
                      android:layout_height="wrap_content"
                      android:layout_margin="?baseGapSize"
                      android:layout_weight="1"
                      android:hint="@string/last_name"
                      android:imeOptions="actionNext|flagNoExtractUi"
                      android:inputType="text|textCapSentences|textNoSuggestions" /&gt;
              &lt;/LinearLayout&gt;
  
              &lt;EditText
                  android:id="@+id/email_address"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:layout_margin="?baseGapSize"
                  android:hint="@string/opentable_email"
                  android:imeOptions="actionNext|flagNoExtractUi"
                  android:inputType="textEmailAddress" /&gt;
  
              &lt;EditText
                  android:id="@+id/password"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:layout_margin="?baseGapSize"
                  android:hint="@string/password"
                  android:imeOptions="actionNext|flagNoExtractUi"
                  android:inputType="textPassword" /&gt;
          &lt;/LinearLayout&gt;
  
          &lt;LinearLayout
              android:id="@+id/hidden_signup_fields"
              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:layout_margin="?baseGapSize"&gt;
  
                  &lt;ImageButton
                      android:id="@+id/problem_button"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_alignBottom="@+id/zip_code_edittext"
                      android:layout_alignParentRight="true"
                      android:layout_alignTop="@id/zip_code_edittext"
                      android:background="@null"
                      android:contentDescription="@string/select_country" /&gt;
  
                  &lt;EditText
                      android:id="@id/zip_code_edittext"
                      android:layout_width="fill_parent"
                      android:layout_height="wrap_content"
                      android:layout_toLeftOf="@id/flag_selector"
                      android:gravity="right"
                      android:imeOptions="actionNext|flagNoExtractUi"
                      android:inputType="text|textNoSuggestions"
                      android:paddingRight="?largeGapSize" /&gt;
  
                  &lt;TextView
                      android:id="@+id/zip_code_text"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_alignBaseline="@+id/zip_code_edittext"
                      android:layout_alignLeft="@+id/zip_code_edittext"
                      android:layout_marginLeft="?imageGapSize"
                      android:layout_marginRight="?imageGapSize"
                      android:textAppearance="@style/SubtitleText" /&gt;
              &lt;/RelativeLayout&gt;
  
  
              &lt;RelativeLayout
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:layout_margin="?baseGapSize"&gt;
  
                  &lt;Button
                      android:id="@+id/gender_button"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:layout_marginTop="?baseGapSize"
                      android:gravity="right" /&gt;
  
                  &lt;Spinner
                      android:id="@+id/gender_spinner"
                      android:layout_width="0px"
                      android:layout_height="0px"
                      android:prompt="@string/create_account_gender" /&gt;
  
                  &lt;TextView
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:layout_alignBaseline="@+id/gender_button"
                      android:layout_alignLeft="@+id/gender_button"
                      android:layout_marginLeft="13dp"
                      android:text="@string/gender"
                      android:textAppearance="@style/SubtitleText"
                      android:textColor="@android:color/black" /&gt;
  
                  &lt;TextView
                      android:id="@+id/gender_optional"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_alignBaseline="@+id/gender_button"
                      android:layout_alignRight="@+id/gender_button"
                      android:layout_marginRight="?largeGapSize"
                      android:background="@null"
                      android:text="@string/optional"
                      android:textAppearance="@style/SubtitleText"
                      android:textColor="@color/hint_foreground_light" /&gt;
              &lt;/RelativeLayout&gt;
  
              &lt;RelativeLayout
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:layout_margin="?baseGapSize"&gt;
  
                  &lt;!-- A bunch of stuff that's unimportant --&gt;
              &lt;/RelativeLayout&gt;
  
              &lt;RelativeLayout
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"&gt;
  
                  &lt;Button
                      android:id="@+id/signup_button"
                      android:layout_width="@dimen/tablet_max_button_size"
                      android:layout_height="wrap_content"
                      android:layout_centerHorizontal="true"
                      android:layout_gravity="center"
                      android:layout_marginTop="20dp"
                      android:padding="@dimen/sign_up_button_padding"
                      android:text="@string/sign_up"
                      android:textAppearance="@style/LargeDarkText" /&gt;
  
                  &lt;TextView
                      android:id="@+id/terms_of_service"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:layout_below="@id/signup_button"
                      android:gravity="center"
                      android:paddingBottom="8dp"
                      android:paddingTop="8dp"
                      android:textAppearance="@style/LargeLightText" /&gt;
              &lt;/RelativeLayout&gt;
          &lt;/LinearLayout&gt;
      &lt;/LinearLayout&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p></p>
  
  <p>That layout then gets put into a <code>ScrollView</code></p>