title: Implementing Swipe and Click in Android Button
body: <p>I am new to android development, I tried to implement swipe (using Ontouch) for Activity and click events for the buttons in activity. If I swipe on top of buttons, swipe event is not getting generated.</p>
  
  <p>If i add swipe for buttons, onclick event for the buttons are not getting generated.</p>
  
  <p>What am i supposed to do, to solve this problem.</p>
  
  <p>In case of any clarification, please ask me.</p>
  
  <p>Layout code:</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_container"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="@drawable/default_2x"
      android:paddingBottom="@dimen/activity_vertical_margin"
      android:paddingLeft="@dimen/activity_horizontal_margin"
      android:paddingRight="@dimen/activity_horizontal_margin"
      android:paddingTop="@dimen/activity_vertical_margin"
      tools:context=".LearnUpperCaseActivity" &gt;
  
      &lt;LinearLayout
          android:id="@+id/content_container"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:orientation="vertical" &gt;
  
          &lt;TextView
              android:id="@+id/title"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:gravity="center_horizontal"
              android:text="@string/learn_uppercase"
              android:textAppearance="?android:attr/textAppearanceLarge" /&gt;
  
          &lt;RelativeLayout
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:layout_weight="11"
              android:background="@drawable/main_area_blue_2x" &gt;
  
              &lt;TextView
                  android:id="@+id/question"
                  android:layout_width="fill_parent"
                  android:layout_height="fill_parent"
                  android:gravity="center"
                  android:text="@string/hard_coded_char" /&gt;
          &lt;/RelativeLayout&gt;
  
          &lt;TextView
              android:id="@+id/instruction"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:gravity="center"
              android:text="@string/tab_below" /&gt;
  
          &lt;RelativeLayout
              android:id="@+id/button_container"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:layout_weight="9"
              android:padding="3dp" &gt;
  
              &lt;LinearLayout
                  android:id="@+id/row1"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:orientation="horizontal" &gt;
  
                  &lt;Button
                      android:id="@+id/button1"
                      style="@style/UpperCaseButton"
                      android:layout_width="wrap_content"
                      android:layout_height="50dp"
                      android:layout_margin="3dp"
                      android:layout_weight="1"
                      android:background="@drawable/blue_button"
                      android:onClick="button1Pressed"
                      android:text="@string/hard_coded_char" &gt;
                  &lt;/Button&gt;
  
                  &lt;Button
                      android:id="@+id/button2"
                      style="@style/UpperCaseButton"
                      android:layout_width="wrap_content"
                      android:layout_height="50dp"
                      android:layout_margin="3dp"
                      android:layout_weight="1"
                      android:background="@drawable/brown_button_2x"
                      android:onClick="button2Pressed"
                      android:text="@string/hard_coded_char" &gt;
                  &lt;/Button&gt;
  
                  &lt;Button
                      android:id="@+id/button3"
                      style="@style/UpperCaseButton"
                      android:layout_width="wrap_content"
                      android:layout_height="50dp"
                      android:layout_margin="3dp"
                      android:layout_weight="1"
                      android:background="@drawable/dark_green_2x"
                      android:onClick="button3Pressed"
                      android:text="@string/hard_coded_char" &gt;
                  &lt;/Button&gt;
              &lt;/LinearLayout&gt;
  
              &lt;LinearLayout
                  android:id="@+id/row2"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:layout_below="@+id/row1"
                  android:orientation="horizontal" &gt;
  
                  &lt;Button
                      android:id="@+id/button4"
                      style="@style/UpperCaseButton"
                      android:layout_width="wrap_content"
                      android:layout_height="50dp"
                      android:layout_margin="3dp"
                      android:layout_weight="1"
                      android:background="@drawable/fluora_button_2x"
                      android:onClick="button4Pressed"
                      android:text="@string/hard_coded_char" &gt;
                  &lt;/Button&gt;
  
                  &lt;Button
                      android:id="@+id/button5"
                      style="@style/UpperCaseButton"
                      android:layout_width="wrap_content"
                      android:layout_height="50dp"
                      android:layout_margin="3dp"
                      android:layout_weight="1"
                      android:background="@drawable/green_button_2x"
                      android:onClick="button5Pressed"
                      android:text="@string/hard_coded_char" &gt;
                  &lt;/Button&gt;
  
                  &lt;Button
                      android:id="@+id/button6"
                      style="@style/UpperCaseButton"
                      android:layout_width="wrap_content"
                      android:layout_height="50dp"
                      android:layout_margin="3dp"
                      android:layout_weight="1"
                      android:background="@drawable/maroon_2x"
                      android:onClick="button6Pressed"
                      android:text="@string/hard_coded_char" &gt;
                  &lt;/Button&gt;
              &lt;/LinearLayout&gt;
  
              &lt;LinearLayout
                  android:id="@+id/row3"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:layout_below="@+id/row2"
                  android:orientation="horizontal" &gt;
  
                  &lt;Button
                      android:id="@+id/button7"
                      style="@style/UpperCaseButton"
                      android:layout_width="wrap_content"
                      android:layout_height="50dp"
                      android:layout_margin="3dp"
                      android:layout_weight="1"
                      android:background="@drawable/yellow_button_2x"
                      android:onClick="button7Pressed"
                      android:text="@string/hard_coded_char" &gt;
                  &lt;/Button&gt;
  
                  &lt;Button
                      android:id="@+id/button8"
                      style="@style/UpperCaseButton"
                      android:layout_width="wrap_content"
                      android:layout_height="50dp"
                      android:layout_margin="3dp"
                      android:layout_weight="1"
                      android:background="@drawable/purple_button_2x"
                      android:onClick="button8Pressed"
                      android:text="@string/hard_coded_char" &gt;
                  &lt;/Button&gt;
  
                  &lt;Button
                      android:id="@+id/button9"
                      style="@style/UpperCaseButton"
                      android:layout_width="wrap_content"
                      android:layout_height="50dp"
                      android:layout_margin="3dp"
                      android:layout_weight="1"
                      android:background="@drawable/pink_button_2x"
                      android:onClick="button9Pressed"
                      android:text="@string/hard_coded_char" &gt;
                  &lt;/Button&gt;
              &lt;/LinearLayout&gt;
  
              &lt;LinearLayout
                  android:id="@+id/row4"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:layout_below="@+id/row3"
                  android:gravity="center"
                  android:orientation="horizontal" &gt;
  
                  &lt;Button
                      android:id="@+id/home"
                      style="@style/UpperCaseButton"
                      android:layout_width="150dp"
                      android:layout_height="30dp"
                      android:layout_margin="3dp"
                      android:background="@drawable/blue_long_button_2x"
                      android:onClick="home"
                      android:text="@string/home" &gt;
                  &lt;/Button&gt;
              &lt;/LinearLayout&gt;
          &lt;/RelativeLayout&gt;
      &lt;/LinearLayout&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>see the image in this link. <a href="https://sites.google.com/site/temptemptemp123tempqwe/doubt.jpg?attredirects=0" rel="nofollow">https://sites.google.com/site/temptemptemp123tempqwe/doubt.jpg?attredirects=0</a></p>
  
  <p>Please help me to solve this issue.</p>
  
  <p>Regards,
  Bennet.</p>