title: Animate zoom in via center of an image in Android with xml
body: <p>I am trying to do some simple image zooming and panning with Android and I have two simple questions.</p>
  <p>First, when I call the animation using <code>scale</code>, it zooms using the upper left-hand corner of the image as the origin but I would like it to zoom from the center of the image.<br />
  The second question is once the animation is done, it resets the image to the original state and I would like it to stay at the final state.</p>
  <p>Here is the xml I have for the scale:</p>
  <pre><code>&lt;scale android:fromXScale=&quot;1.0&quot;
      android:fromYScale=&quot;1.0&quot;
      android:toXScale=&quot;2.0&quot;
      android:toYScale=&quot;2.0&quot;
      android:detachWallpaper=&quot;true&quot;
      android:duration=&quot;3000&quot;&gt;&lt;/scale&gt;
  </code></pre>
  <p>and in my code:</p>
  <pre><code>a = AnimationUtils.loadAnimation(this, R.anim.set);
  a.reset();
  ImageView iv = (ImageView) findViewById(R.id.imageView1);
  iv.clearAnimation();
  iv.startAnimation(a);
  </code></pre>