title: Android: How to maintain aspect-ratio in animation
body: <p>The animation I am running inside an imageview refuses to maintain the aspect-ratio of the image frames. The following answers in SO are quite informative, but don't seem to work for me:
  <a href="https://stackoverflow.com/questions/2521959/how-to-scale-an-image-in-imageview-to-keep-the-aspect-ratio">How to scale an Image in ImageView to keep the aspect ratio</a></p>
  
  <p>Here is the code:</p>
  
  <pre><code>private void startAnimation(){
      mImageView.setAdjustViewBounds(true);
      mImageView.setScaleType(ScaleType.CENTER);
      mImageView.setBackgroundResource(R.anim.my_animation);
  
      AnimationDrawable frameAnimation = (AnimationDrawable) mImageView.getBackground();
  
       // Start the animation (looped playback by default).
       frameAnimation.start();
  }
  </code></pre>
  
  <p>R.anim.my_animation is just an animation list:</p>
  
  <pre><code>&lt;animation-list xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/selected"
  android:oneshot="false"&gt;
  &lt;item
      android:drawable="@drawable/photo_1"
      android:duration="100" /&gt;
  &lt;item
      android:drawable="@drawable/photo__2"
      android:duration="100" /&gt;
      ... and so on...
  &lt;/animation-list&gt;
  </code></pre>