Android Programming Simple Start screen implementation method _android

Source: Internet
Author: User
Tags sqlite database xmlns

This article describes the Android simple Start screen implementation method. Share to everyone for your reference, specific as follows:

After each Android application starts, a splash boot interface appears, showing the product logo, company logo, or developer information. If the application startup time is longer, then the start interface is a good thing to allow users to patiently wait for this boring time, improve the user experience.

1. Splash.xml Layout file

<relativelayout xmlns:android= "http://schemas.android.com/apk/res/android"
  xmlns:tools= "http:// Schemas.android.com/tools "
  android:layout_width=" match_parent "
  android:layout_height=" Match_parent "
  tools:context= ". Splashactivity ">
  <imageview
    android:layout_width=" match_parent "
    android:layout_height=" match _parent "
    android:background=" @drawable/welcome_android "
    android:scaletype=" Fitcenter "/>
</ Relativelayout>

2. Splashactivity class, using the handler postdelayed method, 3 seconds to jump to the main view

Package Cn.eoe.leigo.splash;
Import android.app.Activity;
Import android.content.Intent;
Import Android.os.Bundle;
Import Android.os.Handler; /** * * @{#} splashactivity.java Create on 2013-5-2 pm 9:10:01 * Class desc: Splash Screen * * <p>copyright:copyrigh T (c) 2013 </p> * @Version 1.0 * @Author <a href= "mailto:gaolei_xj@163.com" >Leo</a> * * */PUBLIC CL
  Ass Splashactivity extends Activity {//Latency 3 sec private static final long Splash_delay_millis = 3000;
    @Override protected void OnCreate (Bundle savedinstancestate) {super.oncreate (savedinstancestate);
    Setcontentview (R.layout.splash);
        Using the Handler postdelayed method, perform a jump to mainactivity new Handler () after 3 seconds. postdelayed (New Runnable () {public void run () {
      GoHome ();
  }}, Splash_delay_millis);
    } private void GoHome () {Intent Intent = new Intent (splashactivity.this, Mainactivity.class);
    SplashActivity.this.startActivity (Intent);
  SplashActivity.this.finish ();}
}

 

3. Configure Androidmanifest.xml

<?xml version= "1.0" encoding= "Utf-8"?> <manifest xmlns:android= "http://schemas.android.com/apk/res/" Android "package=" Cn.eoe.leigo.splash "android:versioncode=" 1 "android:versionname=" 1.0 "> <uses-sdk and roid:minsdkversion= "android:targetsdkversion="/> <application android:icon= "@drawable/logo" Droid:label= "@string/app_name" > <activity android:name= ". Splashactivity "android:configchanges=" Keyboardhidden "android:label=" @string/app_name "Android:launchmo De= "Singletask" android:screenorientation= "Portrait" Android:theme= "@android: Style/theme.notitlebar.fullscreen  "> <intent-filter> <action android:name=" Android.intent.action.MAIN "/> <category  Android:name= "Android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity Android:name= ".

 Mainactivity "/> </application>

PS: About Androidmanifest.xml file related properties can refer to the site online tools:

Android manifest Features and Permissions description Encyclopedia:
Http://tools.jb51.net/table/AndroidManifest

For more information on Android-related content readers can view the site: "The activity of Android programming skills Summary", "Android View Summary", "Android operation SQLite Database Skills Summary", " Android operation JSON format data tips summary, "Android Database Operation skills Summary", "Android File Operation skills Summary", "Android programming development of SD card Operation Summary", "Android Development introduction and Advanced Course", " Android Resource Operation tips Summary and the "Android Controls usage Summary"

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.