The example of this article describes the implementation of Android splash screen. Share to everyone for your reference. The specific analysis is as follows:
A splash screen is often used in an application to start a background thread to prepare resources for running the main program.
Android to implement the splash screen you can do this:
This is the code for the Splash.xml layout file:
Copy Code code as follows:
<linearlayout
Xmlns:android= "Http://schemas.android.com/apk/res/android"
android:layout_height= "Fill_parent" android:layout_width= "fill_parent" android:orientation= "vertical" >
<imageview android:layout_height= "fill_parent" android:layout_width= fill_parent "android:scaleType=" FitCenter "Android:src=" @drawable/splash "></ImageView>
</LinearLayout>
Put a imageview load splash picture
Splashactivity starts as the main view:
Copy Code code as follows:
/** called the activity is a. */
@Override
public void OnCreate (Bundle savedinstancestate) {
Super.oncreate (savedinstancestate);
Setcontentview (R.layout.splash);
Handler x = new Handler ();
X.postdelayed (New Splashhandler (), 2000);
}
Class Splashhandler implements runnable{
public void Run () {
StartActivity (New Intent (Getapplication (), mainactivity.class));
SplashActivity.this.finish ();
}
}
I hope this article will help you with your Android program.