我正在使用以下代码来设置逐帧动画:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
final ImageView back = (ImageView) findViewById(R.id.splash_image);
back.setBackgroundResource(R.drawable.splash_animation);
AnimationDrawable frameAnimation = (AnimationDrawable) back.getBackground();
// Start the animation (looped playback by default).
frameAnimation.setExitFadeDuration(2000);
frameAnimation.start();
}
但是,setExitFadeDuration
只有在 API 级别 11 之后才有效。我用来使动画与 API 7 以后兼容的代码是否有替代方法