title: Android studio - creating transition/animation for an ImageView using Interpolator(s)
body: <p>I was wondering if someone could help me with my code. Down bellow is the code
  that I found on the internet, and adjust it a bit. So for a button is set a <strong>onClickListener</strong> method, that includes two methods, which are used when the button is pressed. So the code works, but not the way I imagined it to. When the button is pressed, it dissapears and flows in to the screen from the left with it's <strong>AccelerateInterpolator.</strong> What I would like it to do and for other buttons that are in my application is that. when the button is pressed it would go from <strong>it's current location</strong> (let's say -center of the screen) and it would flow out of the screen and then <strong>coming back to it's location</strong>. </p>
  
  <p>I don't know how to set the parameters right or to change the methods.
  thanks for the help</p>
  
  <pre><code>button1.setOnClickListener(new View.OnClickListener() {
  
          public void onClick(View view) {
  
  
              findViewById(R.id.button1);
  
              TranslateAnimation translation;
              translation = new TranslateAnimation(getDisplayHeight(), 0f, 0f, 0f);
              translation.setStartOffset(500);
              translation.setDuration(2000);
              translation.setFillAfter(true);
              translation.setInterpolator(new AccelerateInterpolator());
              findViewById(R.id.button1).startAnimation(translation);
  
              button2.setVisibility(View.VISIBLE);
  
  
          }
  
          private int getDisplayHeight() {
              DisplayMetrics metrics = new DisplayMetrics();
              getWindowManager().getDefaultDisplay().getMetrics(metrics);
              return metrics.widthPixels;
          }
  
      });
  </code></pre>