Main activity
PackageCom.splash.screen;Importandroid.app.Activity;Importandroid.content.Intent;Importandroid.content.res.Configuration;ImportAndroid.os.Bundle;ImportAndroid.os.Handler;ImportAndroid.util.Log;ImportAndroid.view.Window;ImportAndroid.view.WindowManager;Importandroid.view.animation.AlphaAnimation;Importandroid.view.animation.Animation;ImportAndroid.widget.ImageView;ImportCom.newbravo.sg.Game;ImportCOM.NEWBRAVO.SG.R;/*** Created by Lyhd on 2016/8/2.*/ Public classLogosplashactivityextendsActivity {Privatelogosplashactivity mysplashactivity; @Overrideprotected voidonCreate (Bundle savedinstancestate) {Super. OnCreate (savedinstancestate); LOG.D ("Logosplashactivity", "OnCreate"); Mysplashactivity= This; //Cancel Title This. Requestwindowfeature (Window.feature_no_title); //Cancel status bar This. GetWindow (). SetFlags (WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULL screen); Setcontentview (R.layout.logo_splash); LOG.D ("Cgz_android:", This. Getexternalfilesdir (NULL). toString ()); //The first mode of splash screen//The core code of the splash screen//new Handler (). postdelayed (New Runnable () {//@Override//Public void Run () {//Intent Intent = new Intent (Logosplashactivity.this,//Game.class); //jump from the start animation UI to the main UI//startactivity (intent);//mysplashactivity.overridependingtransition (R.anim.in_screen,//r.anim.out_screen);//LogoSplashActivity.this.finish ();//End Start Animation interface//// }//}, 3000); //Start animation lasts 3 seconds//The second wayImageView logoimage= (ImageView) This. Findviewbyid (R.id.logo_splash); Alphaanimation alphaanimation=NewAlphaanimation (0.1f, 1.0f); Alphaanimation.setduration (3000); Logoimage.startanimation (alphaanimation); Alphaanimation.setanimationlistener (NewAnimation.animationlistener () {@Override Public voidOnanimationstart (Animation Animation) {} @Override Public voidonanimationrepeat (Animation Animation) {} @Override Public voidonanimationend (Animation Animation) {Intent Intent=NewIntent (); Intent.setclass (logosplashactivity. This, Game.class); Intent.setaction (Intent.action_main); Intent.addcategory (Intent.category_launcher); StartActivity (Intent); //startactivity (New Intent ("Com.google.app.splashy.CLEARSPLASH"));finish (); } }); } @Override Public voidonconfigurationchanged (Configuration newconfig) {Super. onconfigurationchanged (Newconfig); } @Overrideprotected voidOnPause () {Super. OnPause (); } @Overrideprotected voidOnresume () {Super. Onresume (); }}
The 1 layout used
<?XML version= "1.0" encoding= "Utf-8"?><LinearLayoutxmlns:android= "Http://schemas.android.com/apk/res/android"android:orientation= "vertical"Android:layout_width= "Match_parent"Android:layout_height= "Match_parent"> <ImageViewAndroid:layout_width= "Fill_parent"Android:layout_height= "Fill_parent"android:layout_gravity= "Center"Android:id= "@+id/logo_splash"android:src= "@drawable/logo_splash"/></LinearLayout>
Android App splash screen