1 PackageCom.leolu.fristapp;2 3 Importandroid.app.Activity;4 ImportAndroid.os.Bundle;5 ImportAndroid.view.View;6 Importandroid.view.animation.AlphaAnimation;7 Importandroid.view.animation.Animation;8 ImportAndroid.view.animation.Animation.AnimationListener;9 Ten Public classSplashpageextendsActivity { One A @Override - protected voidonCreate (Bundle savedinstancestate) { - Super. OnCreate (savedinstancestate); the - //Get activity_splash_page.xml layout -View view = View.inflate ( This, R.layout.activity_splash_page,NULL); - //Loading Layouts + Setcontentview (view); - + //animate, Fade fade available alphaanimation, morph animation with rotateanimation, displacement animation with translateanimation A //The first parameter has a value of 0.3f to start with a transparency of 30%, the second parameter value of 1.0f is the end of the transparency of 100%, that is, opaque. atAlphaanimation alphaanimation =NewAlphaanimation (0.3f, 1.0f); - - //set the duration of the animation, if not set, the time is 0, the animation will not see the effect -Alphaanimation.setduration (2000); - - //run the animation for our background in view.startanimation (alphaanimation); - to //set up an animation listener +Alphaanimation.setanimationlistener (NewAnimationlistener () { - the@Override//The animation starts by doing the following * Public voidOnanimationstart (Animation Animation) { $ Panax Notoginseng } - the@Override//The following methods are performed when the animation repeats + Public voidonanimationrepeat (Animation Animation) { A the } + -@Override//at the end of the animation, perform the following methods $ Public voidonanimationend (Animation Animation) { $ - } - }); the - }Wuyi the -}
Android Simple Welcome animation