Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to Animate two image view from Center to opposite to each other?
    primarykey
    data
    text
    <p>i want to animate the two images from middle of the screen to opposite to each other. like below image.</p> <p><img src="https://i.stack.imgur.com/dcJyV.png" alt="enter image description here"></p> <p>whatever i have done so far is right now i am able animate only one image from left to right and vice versa but now i want to animate them from middle.</p> <p>here is my code :</p> <pre><code>b1 = (Button) findViewById(R.id.button1); logo = (ImageView) findViewById(R.id.imageView1); Display display = getWindowManager().getDefaultDisplay(); width = display.getWidth(); final Animation posX = new TranslateAnimation(0, width - 50, 0, 0); posX.setDuration(1500); posX.setFillAfter(true); b1.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { logo.startAnimation(posX); logo.setVisibility(View.VISIBLE); } }); </code></pre> <p><strong>Edit:</strong></p> <pre><code>&lt;RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_marginTop="40dp" 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:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_marginLeft="50dp" android:contentDescription="@string/hello_world" android:src="@drawable/prev_btn" /&gt; &lt;ImageView android:id="@+id/ImageView01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_toRightOf="@+id/imageView1" android:contentDescription="@string/hello_world" android:src="@drawable/next_btn" /&gt; &lt;/RelativeLayout&gt; </code></pre> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload