Android splash Screen Effect Implementation method _android

Source: Internet
Author: User

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.

Related Article

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.