Android AnimationDrawable缩放要设置动画的图像
我想设置四个图像的动画以显示在一行中。在布局XML文件中,我创建了一个ImageView:Android AnimationDrawable缩放要设置动画的图像,android,imageview,animationdrawable,Android,Imageview,Animationdrawable,我想设置四个图像的动画以显示在一行中。在布局XML文件中,我创建了一个ImageView: <ImageView android:id="@+id/exercisesAnimated" android:layout_width="wrap_content" android:layout_height="wrap_content" android:adjustViewBounds="true"
<ImageView
android:id="@+id/exercisesAnimated"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:layout_gravity="center_horizontal"/>
所以我的问题是动画图像变得非常小,就像原始图像大小的1/3。这些有一个460x250的大小,我希望他们被显示在该大小
如果我只是将一个android:src=“@drawable/oneofimages”
放在ImageView中,而不做动画,那么图像将以正确的大小显示
怎么了?尝试将您的jpg文件放入res/drawable nodpi文件夹,并在startAnimation方法中将其作为drawable拉入,如下所示:
getResources().getDrawable(R.drawable.1) // this will pull the 1.jpg file and return a Drawable
为什么要将您的jpg文件放在资产中?为什么不直接使用res/drawable/文件夹呢?我需要子文件夹,这在res/drawable中是不可能的。谢谢,它们仍然不是原始大小,但至少我现在可以缩放ImageView,所以我很好。
getResources().getDrawable(R.drawable.1) // this will pull the 1.jpg file and return a Drawable