Slide image from left to right and right to left
<p>I am developing an application in which I want to add image which can slide from left to right and from right to left like below image. That inner white play image should be move from left to right and Vice Versa.</p>

<p><img src="http://i.stack.imgur.com/icfsZ.png" alt="enter image description here"></p>

<p>What I have did so far is, I am able to move single image from left to right and vice versa but I want set background image as well like above rounded shaped black background.</p>

<p>Here is my code:</p>

<pre><code>imageView.setOnTouchListener(new OnTouchListener() {

    public boolean onTouch(View v, MotionEvent event) {
        // TODO Auto-generated method stub
        int eid = event.getAction();
        switch (eid) {
        case MotionEvent.ACTION_MOVE:

            RelativeLayout.LayoutParams mParams = (RelativeLayout.LayoutParams) imageView.getLayoutParams();
            int x = (int) event.getRawX();
            mParams.leftMargin = x - 50;
            imageView.setLayoutParams(mParams);

            break;

        default:
            break;
        }
        return true;
    }
});
</code></pre>

<p><strong>EDIT</strong></p>

<p>I tried to manage background image by setting my layout xml like below:</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" &gt;

    &lt;RelativeLayout
        android:layout_width="250dp"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="49dp"
        android:background="@drawable/set_user_profile_back"
        android:paddingLeft="10dp"
        android:paddingRight="10dp" &gt;

        &lt;ImageView
            android:id="@+id/imageView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:contentDescription="@string/hello_world"
            android:src="@drawable/next" /&gt;
    &lt;/RelativeLayout&gt;

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

<p>But now I am facing problem with image size, image size is decreased in right how to solve this and how to fix start and end point for image movement.</p>

<p><img src="http://i.stack.imgur.com/nerI1.png" alt="enter image description here"></p>

<p>Any idea and advice will be apppreciated</p>
