或onStart或onResume也不行。
求解。

解决方案 »

  1.   

    animationDrawable是一个AnimationDrawable(废话……)
    定义如下:
    imageView.setBackgroundResource(R.drawable.anim_list);
    animationDrawable=(AnimationDrawable)imageView.getBackground();
    ---------------放在一个监听器就能播放动画--------------------------------
    imageView.setOnClickListener(new OnClickListener() {
    @Override
    public void onClick(View v) {
    // TODO Auto-generated method stub
    animationDrawable.start();
    }
    });
    ---------------放在一个onCreate里就不行--------------------------------
    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    animationDrawable.start();
                            }
      

  2.   

    public void start ()Added in API level 1
    Starts the animation, looping if necessary. This method has no effect if the animation is running. Do not call this in the onCreate(Bundle) method of your activity, because the AnimationDrawable is not yet fully attached to the window. If you want to play the animation immediately, without requiring interaction, then you might want to call it from the onWindowFocusChanged(boolean) method in your activity, which will get called when Android brings your window into focus.