KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
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: How to scale an Image in ImageView to keep the aspect ratio Here is the 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(); } R.anim.my_animation is just an animation list: <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>
Tags (comma-separated)
Save Edits
Cancel