为什么我 ImageView imageView = (ImageView)findViewById(R.id.anim);

final AnimationDrawable anim = (AnimationDrawable)imageView
.getBackground();

anim.start();
这样不动,但是 ImageView imageView = (ImageView)findViewById(R.id.anim);
//获取AnimationDrawable动画对象
final AnimationDrawable anim = (AnimationDrawable)imageView
.getBackground();
play.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View v)
{
//开始播放动画
anim.start();
}
});
这样却动了呢,应用程序启动动画到底如何实现比较好呢

解决方案 »

  1.   

    我找到答案了
    http://www.eoeandroid.com/thread-31658-1-1.html
      

  2.   

    NND,我现在也有个这样的问题,我的动画啥都没问题了,现在就是走不到synchronized加载onDraw()这一步,郁闷啊
      

  3.   

    import com.jfwt.R;import android.app.Activity;
    import android.content.Intent;
    import android.os.Bundle;
    import android.view.animation.AlphaAnimation;
    import android.view.Window;
    import android.view.animation.Animation;
    import android.view.animation.Animation.AnimationListener;public class LogoActivity extends Activity {
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            //去掉标题栏
            this.requestWindowFeature(Window.FEATURE_NO_TITLE);
            this.setContentView(R.layout.logo);
            
            //透明度动画
            AlphaAnimation alphaAnimation = new AlphaAnimation(0.1f,1.0f);       
            alphaAnimation.setDuration(3000);
            
            alphaAnimation.setAnimationListener(new AnimationListener(){         @Override
    public void onAnimationStart(Animation animation) {
    // TODO Auto-generated method stub

    }
            
    @Override
    public void onAnimationEnd(Animation animation) {
    // TODO Auto-generated method stub
    Intent intent = new Intent(LogoActivity.this,LoginActivity.class);
    startActivity(intent);
    finish();
    } @Override
    public void onAnimationRepeat(Animation animation) {
    // TODO Auto-generated method stub

    }

            });
            this.findViewById(R.id.logoback).startAnimation(alphaAnimation);
        }
    }这是一个简单的三秒透明度动画,透明度动画过后可根据你的需要跳转到其他Activity