AnimationDrawable不适用于2.3.6 android版本

Asm*_*ita 6 android android-animation

AnimationDrawable不适用于2.3.6 android版本.

是否有较旧版本的支持库?

我的代码是:

iv = (ImageView) findViewById(R.id.splashnew);
BitmapDrawable f0 = (BitmapDrawable)getResources().getDrawable(R.drawable.s1); 
BitmapDrawable f1 = (BitmapDrawable)getResources().getDrawable(R.drawable.s2); 
BitmapDrawable f2 = (BitmapDrawable)getResources().getDrawable(R.drawable.s3);
int dur = 850; 
AnimationDrawable ad = new AnimationDrawable();
ad.addFrame(f0, dur); 
ad.addFrame(f1, dur); 
ad.addFrame(f2, dur);
ad.start();
ad.setOneShot(true);
Run Code Online (Sandbox Code Playgroud)

Asm*_*ita 19

我得到了答案:

您应该在runnable中启动动画.

    iv.post(new Runnable(){
        public void run(){
             ad.start();
             ad.setOneShot(true); // use this if you want to run the animation only once
        }
    });
Run Code Online (Sandbox Code Playgroud)