My Android Best Practices--android boot Screen implementation method

Source: Internet
Author: User

This article describes the implementation of the Android splash screen. Share to everyone for your reference. The specific analysis is as follows:

When the splash screen is used frequently in the application, a background thread is started to prepare resources for running the master program.
Android to implement the splash screen can do this:

Here is the code for the Splash.xml layout file:

<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 screen picture
Splashactivity starts as the main view:

/**Called when the activity is first created.*/@Override Public voidonCreate (Bundle savedinstancestate) {Super. OnCreate (savedinstancestate);         Setcontentview (R.layout.splash); Handler x=NewHandler (); X.postdelayed (NewSplashhandler (), 2000); } classSplashhandlerImplementsrunnable{ Public voidrun () {startactivity (NewIntent (Getapplication (), mainactivity.class)); Splashactivity. This. Finish (); } }

Hopefully this article will help you with Android programming.

My Android Best Practices--android boot Screen implementation method

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.