title: How to Get ImageView Bring to front on touch event of ImageView?
body: <p>I have two <code>ImageView</code> in two different layouts, the One <code>ImageView</code> is on another <code>ImageView</code> and I am using <code>RelativeLayout</code> &amp; the Both <code>ImageView</code> size is Wrap Content But the problem is if I click on <code>ImageView2</code> that time the <code>Imageview2</code> is displayed on the <code>Imageview1</code> and if I click on <code>ImageView1</code> that time the <code>Imageview1</code> is displayed on the <code>Imageview2</code> I am using bring-to-front method but this is not working. Sorry for bad English Communication. Please Help Me.</p>
  
  <p>Thanks in Advance</p>
  
  <p>Following is My Code.</p>
  
  <p>Main.xml:-</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent" android:layout_height="fill_parent"&gt;
      &lt;RelativeLayout android:layout_width="fill_parent" android:id="@+id/mRlayout1"
          android:layout_height="fill_parent"&gt;
          &lt;ImageView android:layout_width="wrap_content"
              android:scaleType="matrix" android:layout_height="wrap_content"
              android:id="@+id/mImageView1" android:src="@drawable/icon1" /&gt;
      &lt;/RelativeLayout&gt;
      &lt;RelativeLayout android:layout_width="fill_parent" android:id="@+id/mRlayout2"
          android:layout_height="fill_parent" &gt;
          &lt;ImageView android:layout_width="wrap_content"
              android:scaleType="matrix" android:layout_height="wrap_content"
              android:id="@+id/mImageView2" android:src="@drawable/icon" /&gt;
      &lt;/RelativeLayout&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>Java File:-</p>
  
  <pre><code>public class BodyTemp extends Activity {
      ImageView mImageView1, mImageView2;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          // TODO Auto-generated method stub
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
          mImageView1 = (ImageView) findViewById(R.id.mImageView1);
          mImageView1.setOnTouchListener(new OnTouchListener() {
  
              @Override
              public boolean onTouch(View v, MotionEvent event) {
                  // TODO Auto-generated method stub
                  mImageView1.bringToFront();
                  return true;
              }
          });
          mImageView2 = (ImageView) findViewById(R.id.mImageView2);
          mImageView2.setOnTouchListener(new OnTouchListener() {
  
              @Override
              public boolean onTouch(View v, MotionEvent event) {
                  // TODO Auto-generated method stub
                  mImageView2.bringToFront();
                  return true;
              }
          });
      }
  }
  </code></pre>