I have an image that fills the entire screen and uploads images from url to my SD card. I use AnimationDrawable to show these images as a slide show in the image. But, however, I try to make my images lose their aspect ratio, the images look stretched. I tried all type of scans for my image, but did not use it. Here is my code:
AnimationDrawable animation = new AnimationDrawable();
File cacheDir = AlRimal.getDataFolder(Main_Load.this);
File cacheFile = new File(cacheDir, "file_1.jpg");
Drawable d = Drawable.createFromPath(cacheFile.getPath());
Bitmap bitmap = BitmapFactory.decodeFile(cacheFile.getPath());
animation.addFrame(d, 5000);
animation.addFrame(d, 5000);
animation.addFrame(d, 5000);
animation.setOneShot(false);
animation.setExitFadeDuration(500);
animation.setEnterFadeDuration(500);
animationImg.setScaleType(ScaleType.FIT_CENTER);
animationImg.setBackgroundDrawable(animation);
animation.start();
The resolution of my images: 2048 * 1536
source
share