title: Android image scale animation relative to center point
body: <p>I have an ImageView and I do a simple scale animation to it. Very standard code.</p>
  <p>My scale_up.xml:</p>
  <pre><code>&lt;set xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;&gt;
      &lt;scale android:fromXScale=&quot;1&quot;
             android:fromYScale=&quot;1&quot;
             android:toXScale=&quot;1.2&quot;
             android:toYScale=&quot;1.2&quot;
             android:duration=&quot;175&quot;/&gt;
  &lt;/set&gt;
  </code></pre>
  <p>My animation code:</p>
  <pre><code>Animation a = AnimationUtils.loadAnimation(this, R.anim.scale_up);
  ((ImageView) findViewById(R.id.circle_image)).startAnimation(a);
  </code></pre>
  <p>The problem:</p>
  <p>When the image scales it doesn't scale from the center, but from the top left corner. In other words, the scaled version of the image doesn't have the same point as the center, but it has the same top-left point.
  Here's an image that explains what I mean:</p>
  <p><a href="https://i.stack.imgur.com/p1MYpt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/p1MYpt.png" alt="How the animation scales" /></a>
  <a href="https://i.stack.imgur.com/YGxgwt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YGxgwt.png" alt="How I want it" /></a></p>
  <p>The first image is how the animation scales and the second image is how I want it to scale. It should keep the center point the same.
  I have tried setting up gravity on the image, on the container, aligning left or right, it always scales the same.</p>
  <p>I'm using RelativeLayout for the main screen and ImageView is located into another RelativeLayout, but I tried other layouts, no change.</p>