An example of this article describes the implementation of the Android splash screen effect. Share to everyone for your reference, specific as follows:
Splash screen, is splashscreen, can also be said to start the screen, is the start of the time, Flash (show), lasted a few seconds, automatic shutdown.
The Android implementation is very simple and can be achieved using the Postdelayed method of the handler object. Pass a Runnable object and a delay time in this method. This method implements a deferred execution effect, which is specified by the 2nd parameter in milliseconds. The first parameter is the Runnable object, which contains the actions that need to be performed after the delay. The demo code is as follows:
Java code:
Package Com.mstar;
Import android.app.Activity;
Import android.content.Intent;
Import Android.os.Bundle;
Import Android.os.Handler;
public class Actsplashscreen extends activity{
@Override
protected void onCreate (Bundle savedinstancestate) { C8/>super.oncreate (savedinstancestate);
Setcontentview (R.layout.shan);
The core code for the splash screen is
new Handler (). postdelayed (New Runnable () {
@Override public
void Run () {
Intent Intent = New Intent (Actsplashscreen.this,dialogtest.class);
Jump from the start animation UI to the main UI
startactivity (intent);
ActSplashScreen.this.finish (); End start Animation interface
}
, 3000); Start animation lasts 3 seconds
}
XML code:
<?xml version= "1.0" encoding= "UTF-8"?> <linearlayout xmlns:android=
"http://schemas.android.com/apk/" Res/android "
android:orientation=" vertical "
android:layout_width=" fill_parent "
android:layout_" height= "Fill_parent"
>
<textview
android:layout_width= "fill_parent"
android:layout_ height= "Fill_parent"
android:text= "Flash"
>
</TextView>
</LinearLayout>
For more information about Android development interested readers can view the site: "Android Development Animation Tips Summary", "Android Multimedia operating skills Summary (audio, video, audio, etc.)" and "Android Development introduction and Advanced Course"
I hope this article will help you with the Android program.