イメージビュー内で実行しているアニメーションは、イメージ フレームのアスペクト比を維持することを拒否します。SOの次の回答は非常に有益ですが、私にはうまくいかないようです: アスペクト比を維持するためにImageViewで画像をスケーリングする方法
コードは次のとおりです。
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();
}
R.anim.my_animation は単なるアニメーション リストです。
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/selected"
android:oneshot="false">
<item
android:drawable="@drawable/photo_1"
android:duration="100" />
<item
android:drawable="@drawable/photo__2"
android:duration="100" />
... and so on...
</animation-list>