title: onTouch and onClick not triggering properly
body: <p>I have ReltiveLayout with and ImageView and a TextView inside.</p>
  
  <p>So I have two event listeners:</p>
  
  <ul>
  <li><code>onClick</code></li>
  <li><code>onTouch</code></li>
  </ul>
  
  <p>I am using <code>9patch</code> for the image. When I use the onTouch event onClick is not firing at all and also onTouch is not working very good. If I disable onTouch and leave onClick it fires and changes the Activity. I want to make onTouch and onClick work together. I want:</p>
  
  <ul>
  <li>When the RelativeLayout is clicked it shows the selected button ImageView</li>
  <li>Otherwise display the normal button ImageView</li>
  <li>onClickListener changing the activity.</li>
  </ul>
  
  <p><strong>Heres my code:</strong></p>
  
  <pre><code>StartBtn = (RelativeLayout) findViewById(R.id.StartBtn);
  StartBtnImage = (ImageView) findViewById(R.id.StartBtnImage);
  StartBtnText = (TextView) findViewById(R.id.StartBtnText);
  
  StartBtn.setOnTouchListener(new TouchButton(StartBtnImage)); //Commenting this line makes the onClickListener work
  StartBtn.setOnClickListener(new View.OnClickListener() {
      @Override
      public void onClick(View v) {
          StartBtnImage.setImageResource(R.drawable.btn_selected);
          Log.d("ButtonClick", "Done");
          Intent myIntent = new Intent(MainMenu.this, Game.class);
          startActivity(myIntent);
  
      }
  });
  </code></pre>
  
  <p><strong>And my TouchButton class:</strong></p>
  
  <pre><code>public class TouchButton implements View.OnTouchListener {
  
      ImageView IV;
  
      public TouchButton(ImageView Image) {
          IV = Image;
      }
  
      public boolean onTouch(View v, MotionEvent event) {
          switch (event.getAction()) {
              case MotionEvent.ACTION_DOWN:
                  IV.setImageResource(R.drawable.btn_selected);
                  return true;
              case MotionEvent.ACTION_UP:
              case MotionEvent.ACTION_OUTSIDE:
              default:
                  IV.setImageResource(R.drawable.btn);
                  return false;
          }
      }
  }
  </code></pre>
  
  <p><strong>Here is my layout</strong> </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" android:paddingLeft="@dimen/activity_horizontal_margin"
  android:paddingRight="@dimen/activity_horizontal_margin"
  android:paddingTop="@dimen/activity_vertical_margin"
  android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainMenu"&gt;
  
  &lt;ImageView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:id="@+id/MainMenuBg"
      android:background="@drawable/main_menu_bg" /&gt;
  
  &lt;RelativeLayout
      android:layout_width="250dp"
      android:layout_height="75dp"
      android:layout_alignParentTop="true"
      android:layout_centerHorizontal="true"
      android:layout_marginTop="130dp"
      android:id="@+id/StartBtn"
      android:clickable="true"&gt;
  
      &lt;ImageView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:id="@+id/StartBtnImage"
          android:src="@drawable/btn" /&gt;
  
      &lt;TextView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:textAppearance="?android:attr/textAppearanceMedium"
          android:text="Start"
          android:id="@+id/StartBtnText"
          android:layout_centerVertical="true"
          android:layout_alignParentLeft="true"
          android:layout_alignParentStart="true"
          android:layout_alignParentRight="true"
          android:layout_alignParentEnd="true"
          android:singleLine="false"
          android:gravity="center|center_vertical|center_horizontal"
          android:textSize="50dp" /&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p></p>
  
  <p><strong>I know I'm bad at explaining, so here is a video:</strong> <a href="https://www.youtube.com/watch?v=PtdUsW-Dnqk" rel="nofollow">https://www.youtube.com/watch?v=PtdUsW-Dnqk</a> </p>