android imageview scaletype不适用于AnimationDrawable

sha*_*ath 4 android imageview android-animation android-layout

我有一个imageview填充我的整个屏幕,我从url下载图像到我的SD卡,我使用AnimationDrawable在imageview中将这些图像显示为幻灯片.但是,不过我尝试我的图像会失去它们的宽高比,图像会显得拉长.我已经为我的imageview尝试了所有scaletype,但没有用.这是我的代码:

    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);//All possibilities have been tried
    animationImg.setBackgroundDrawable(animation);
    animation.start();
Run Code Online (Sandbox Code Playgroud)

我的图像重新分配是:2048*1536

sha*_*ath 5

ScaleType没有被设置,因为,在图像ImageView设置为背景.当我把它更改为源它时,它工作.