how to moving many imageView alternately android
<p>i want to create android application.
i have 1 image but i display on 3 image view on difference location</p>

<p>this is ilustration</p>

<pre><code>/////////////////////////////////////////////////

imageView1 imageView2 imageView3


/////////////////////////////////////////////////
</code></pre>

<p>if imageView3 touched to right then imageView3 change to align right</p>

<pre><code>/////////////////////////////////////////////////

imageView1 imageView2              imageView3

/////////////////////////////////////////////////
</code></pre>

<p>if imageView2 touched to right then imageView2 change to left imageView3 then imageView3 stay on align right</p>

<pre><code>/////////////////////////////////////////////////

imageView1              imageView2 imageView3

/////////////////////////////////////////////////
</code></pre>

<p>if imageView2 touched to left then imageView2 change to right imageView1 then imageView1 stay on align left</p>

<pre><code>/////////////////////////////////////////////////

imageView1 imageView2               imageView3

/////////////////////////////////////////////////
</code></pre>

<p>if imageView3 touched to left then imageView3 change to right imageView2 then imageView1 and imageView2 stay on align left</p>

<pre><code>/////////////////////////////////////////////////

imageView1 imageView2 imageView3

/////////////////////////////////////////////////
</code></pre>

<p>if imageView2 touched to right then imageView2 and imageView3 change to right align</p>

<pre><code>/////////////////////////////////////////////////

imageView1                imageView2 imageView3

/////////////////////////////////////////////////
</code></pre>

<p>if imageView1 touched to right then imageView1,imageView2 and imageView3 change to right align</p>

<pre><code>/////////////////////////////////////////////////

               imageView1 imageView2 imageView3

/////////////////////////////////////////////////
</code></pre>

<p>if imageView3 touched to left then imageView1,imageView2 and imageView3 change to left align</p>

<pre><code>/////////////////////////////////////////////////

imageView1 imageView2 imageView3

/////////////////////////////////////////////////
</code></pre>

<p>this my xml file</p>

<pre><code>&lt;RelativeLayout xmlns:tools="http://schemas.android.com/tools"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:gravity="clip_vertical" &gt;

    &lt;ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_marginLeft="5dp"
        android:layout_marginTop="12dp"
        android:src="@drawable/x" /&gt;

    &lt;ImageView
        android:id="@+id/imageView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignTop="@+id/imageView1"
        android:layout_toRightOf="@+id/imageView1"
        android:src="@drawable/x" /&gt;

    &lt;ImageView
        android:id="@+id/imageView3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignTop="@+id/imageView2"
        android:layout_toRightOf="@+id/imageView2"
        android:src="@drawable/x" /&gt;

&lt;/RelativeLayout&gt;
</code></pre>

<p>this is my code</p>

<pre><code>import android.app.Activity;
import android.os.Bundle;
import android.content.pm.ActivityInfo;
import android.view.MotionEvent;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.View.OnTouchListener;
import android.widget.RelativeLayout;
import android.widget.ImageView;

public class MainActivity extends Activity {

    boolean t=true;

    ImageView imageView1,imageView2,imageView3;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR);
         getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
                 WindowManager.LayoutParams.FLAG_FULLSCREEN); 

        setContentView(R.layout.activity_main);
        imageView1 = (ImageView)findViewById(R.id.imageView1);
        imageView2 = (ImageView)findViewById(R.id.imageView2);
        imageView3 = (ImageView)findViewById(R.id.imageView3);


        imageView1.setOnTouchListener(new OnTouchListener() {

            @Override
            public boolean onTouch(View v, MotionEvent event) {
                RelativeLayout.LayoutParams mParams = (RelativeLayout.LayoutParams) imageView1.getLayoutParams();
                if (t){
                    mParams.leftMargin = 48;
                    t=false;
                }else{
                    mParams.leftMargin = 5;
                    t=true;
                }
                imageView1.setLayoutParams(mParams);
                return false;
            }
          });

        imageView2.setOnTouchListener(new OnTouchListener() {

            @Override
            public boolean onTouch(View v, MotionEvent event) {
                RelativeLayout.LayoutParams mParams = (RelativeLayout.LayoutParams) imageView2.getLayoutParams();
                if (t){
                    mParams.leftMargin = 42;
                    t=false;
                }else{
                    mParams.leftMargin = 0;
                    t=true;
                }
                imageView2.setLayoutParams(mParams);
                return false;
            }
          });

        imageView3.setOnTouchListener(new OnTouchListener() {

            @Override
            public boolean onTouch(View v, MotionEvent event) {
                RelativeLayout.LayoutParams mParams = (RelativeLayout.LayoutParams) imageView3.getLayoutParams();
                if (t){
                    mParams.leftMargin = 42;
                    t=false;
                }else{
                    mParams.leftMargin = 0;
                    t=true;
                }
                imageView3.setLayoutParams(mParams);
                return false;
            }
          });



    }
}
</code></pre>

<p>please give me sample code</p>

<p>thanks :)</p>
