title: Move ImageView To Center Of Screen in android
body: <p>i m working in an application which have 2 imageview 1st one is left and onother is in right ...when page will loaded imageview move nd it goes to center of screen..
  i.e</p>
  
  <p><strong>imageview-------->center&lt;----------imageview</strong></p>
  
  <p>i m using translate animation to move the  images which take 4 parameter</p>
  
  <p>i.e</p>
  
  <pre><code> TranslateAnimation (float fromXDelta, float toXDelta, float fromYDelta, float toYDelta)
  </code></pre>
  
  <p>but the problem is nothing is displayed ..</p>
  
  <p>my XML File Is </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"  
  android:id="@+id/topRelativeLayout" &gt;
  
  &lt;LinearLayout
      android:id="@+id/centerLayout"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_alignParentRight="true"
      android:layout_centerVertical="true"
      android:orientation="vertical" &gt;
  
      &lt;ImageView
          android:id="@+id/imageView_header"
          android:layout_width="150dp"
          android:layout_height="80dp"
          android:layout_gravity="left"
          android:layout_marginTop="80dp"
          android:src="@drawable/logo_footer" /&gt;
      &lt;ImageView
          android:id="@+id/imageView_footer"
          android:layout_width="150dp"
          android:layout_height="80dp"
          android:layout_gravity="right"
          android:layout_marginTop="30dp"
          android:src="@drawable/logo_header" /&gt;
  &lt;/LinearLayout&gt;  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>in My Applicationn On createview java code is</p>
  
  <pre><code>   DisplayMetrics displaymetrics = new DisplayMetrics();
      getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
      int height = displaymetrics.heightPixels;
      int width = displaymetrics.widthPixels;
  
  
      Log.d("Screen Width",String.valueOf(width));
      Log.d("Screen Height",String.valueOf(height));
      Log.d("Screen Half Width",String.valueOf(width/2));
      Log.d("Screen HalHeight",String.valueOf(height/2));
  
      header=(ImageView)findViewById(R.id.imageView_header);
      moveImageToLeftToCenter(header,height,width);
      footer=(ImageView)findViewById(R.id.imageView_footer);
      moveImageToRightToCenter( footer,height,width );
  </code></pre>
  
  <p>and the function code is </p>
  
  <pre><code>  public void moveImageToLeftToCenter(ImageView img, int height, int width ){
  
      TranslateAnimation anim = new TranslateAnimation( 0, width/2,height/2,height/2);// - originalPos[0] , 0, yDest - originalPos[1] );
      anim.setDuration(3000);
      anim.setFillAfter( true );
      img.startAnimation(anim);
      }
  
  public void moveImageToRightToCenter(ImageView img,int height, int width ){
  
      TranslateAnimation anim = new TranslateAnimation( width/2, 0,height/2,height/2);// - originalPos[0] , 0, yDest - originalPos[1] );
      anim.setDuration(3000);
      anim.setFillAfter( true );
      img.startAnimation(anim);
  }
  </code></pre>
  
  <p>My Logcat values are</p>
  
  <pre><code>05-11 11:27:33.762: D/Screen Width(4090): 1152
  05-11 11:27:33.762: D/Screen Height(4090): 672
  05-11 11:27:33.762: D/Screen Half Width(4090): 576
  05-11 11:27:33.762: D/Screen HalHeight(4090): 336
  </code></pre>
  
  <p>i cant understand what is the problem..if anyone know than help me....
  thanks in advance friends</p>