title: How to consume child view's touch event in parent view's touchlistener?
body: <p>In my application I want to get the touch event of all child view's in my parent view's <code>onTouchListener</code> but I could not get this.</p>
  
  <p><strong>Example:</strong></p>
  
  <p>In my activity's view I have one frame layout which has some buttons and edittexts in it. So whenever I touch buttons or edit text I want to get this touch event in <strong>framlayout's</strong> <code>onTouchListeners</code>.</p>
  
  <p>Here is my code..</p>
  
  <p><strong>Activity:</strong></p>
  
  <pre><code>private FrameLayout rootView;
      @Override
      public void onCreate(Bundle savedInstanceState)
      {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
  
          rootView = (FrameLayout) findViewById(R.id.rootview);
          rootView.setOnTouchListener(new OnTouchListener()
          {
              @Override
              public boolean onTouch(View v, MotionEvent event)
              {
                  Log.e("Touch Event: ", " X: " + event.getX() + " Y: " + event.getY());
                  return false;
              }
          });
           }
  </code></pre>
  
  <p><strong>main.xml:</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:padding="10dip"
      android:id="@+id/rootview"&gt;
  
  &lt;LinearLayout 
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:background="@android:color/white"
      android:orientation="vertical"
      android:layout_gravity="center" 
      android:padding="10dip"&gt;
  
       &lt;TextView
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_gravity="center"
                      android:padding="4dp"
                      android:text="Login"
                      android:textColor="@android:color/black"
                      android:textSize="16dp"
                      android:textStyle="bold" /&gt;
  
                  &lt;TextView
                      android:layout_width="fill_parent"
                      android:layout_height="wrap_content"
                      android:layout_marginTop="10dp"
                      android:text="Username"
                      android:textColor="@android:color/black"
                      android:textSize="14dp"
                      android:textStyle="bold" /&gt;
  
                  &lt;EditText
                      android:id="@+id/edttextusername"
                      android:layout_width="fill_parent"
                      android:layout_height="wrap_content"
                      android:imeOptions="flagNoExtractUi"
                      android:singleLine="true" /&gt;
  
                  &lt;TextView
                      android:layout_width="fill_parent"
                      android:layout_height="wrap_content"
                      android:layout_marginTop="10dp"
                      android:text="Password"
                      android:textColor="@android:color/black"
                      android:textSize="14dp"
                      android:textStyle="bold" /&gt;
  
                  &lt;EditText
                      android:id="@+id/edttextpassword"
                      android:layout_width="fill_parent"
                      android:layout_height="wrap_content"
                      android:imeOptions="flagNoExtractUi"
                      android:password="true" /&gt;
  
                  &lt;LinearLayout
                      android:layout_width="fill_parent"
                      android:layout_height="wrap_content"
                      android:layout_gravity="center"
                      android:gravity="center"
                      android:orientation="horizontal"
                      android:padding="10dp" &gt;
  
                      &lt;Button
                          android:id="@+id/btnlogin"
                          android:layout_width="0dip"
                          android:layout_height="40dip"
                          android:layout_marginRight="5dp"
                          android:layout_weight="1"
                          android:enabled="false"
                          android:text="Login"
                          android:padding="5dip"
                          android:textColor="@android:color/black"
                          android:textStyle="bold" 
                          /&gt;
  
                      &lt;Button
                          android:id="@+id/btncall"
                          android:layout_width="0dip"
                          android:layout_height="40dip"
                          android:layout_marginLeft="5dp"
                          android:layout_weight="1"
                          android:padding="5dip"
                          android:text="Cancel"
                          android:textColor="@android:color/black"
                          android:textStyle="bold" /&gt;
                  &lt;/LinearLayout&gt;
  
  
  &lt;/LinearLayout&gt;
  
      &lt;/FrameLayout&gt; 
  </code></pre>
  
  <p><strong>Problem:</strong> So whenver I touch the buttons or edittext I can't get touch co-ordition in my frame layout's onTouchListener (It's not called).</p>
  
  <p><strong>Note:</strong> I don't want to add separate onTouchListener for all childViews.</p>
  
  <p>Thanks in advance.</p>