Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ssis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android AnimationDrawable缩放要设置动画的图像_Android_Imageview_Animationdrawable - Fatal编程技术网

Android AnimationDrawable缩放要设置动画的图像

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"

我想设置四个图像的动画以显示在一行中。在布局XML文件中,我创建了一个ImageView:

<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