Android App splash screen

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.