Android Splash

protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        final View view = View.inflate(this, R.layout.activity_splash, null);
        setContentView(view);

        AlphaAnimation alphaAnimation = new AlphaAnimation(0.5f ,1f);
        alphaAnimation.setDuration(3000);

        alphaAnimation.setAnimationListener(new Animation.AnimationListener() {
            @Override
            public void onAnimationStart(Animation animation) {}

            @Override
            public void onAnimationEnd(Animation animation) { redirectToMainFrame(); }

            @Override
            public void onAnimationRepeat(Animation animation) { }
        });

        view.startAnimation(alphaAnimation);
    }

    protected  void redirectToMainFrame()
    {
        Intent intent = new Intent(this, MainActivity.class);
        startActivity(intent);
        finish();
    }

  

posted @ 2014-03-15 19:45  正培雨田  阅读(155)  评论(0)    收藏  举报