Android startup Interface

Source: Internet
Author: User

When starting an app, you often have a startup interface. You can simply set the lunch image in IOS. However, to achieve this effect in AndroidCodeSet manually. The idea is also very simple. There is only one figure to start the view, so that it can sleep for about 2 seconds, and then jump into the mianactivity main interface. Check the Code:

Lunch. xml

 
<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= "Fitxy"Android: SRC= "@ Drawable/lunch"> </imageview> </linearlayout>

Lunchview. Java

Package  Com. gdou. gxk;  Import  Android. App. activity;  Import  Android. content. intent;  Import  Android. OS. Bundle;  Import  Android. OS. Handler;  Public   Class Lunchview Extends  Activity {@ override  Protected  Void  Oncreate (bundle savedinstancestate ){  //  Todo auto-generated method stub          Super  . Oncreate (savedinstancestate); setcontentview (R. layout. Lunch); handler x = New  Handler (); X. postdelayed (  New Lunchhandler (), 2000. );}  Class Lunchhandler Implements Runnable {  Public   Void  Run () {startactivity (  New Intent (getapplication (), loginview. Class  ); Lunchview.  This  . Finish ();}}} 

The loginview is mine.ProgramIn this way, the iPhone's lunch image effect is achieved, simply for the effect.

Finally, you must change the initial interface to lunchview in your configuration file androidmanifest. That's all !!!

 

Update:

The loginview after the lunchview is required in the project to be judged (if the database has a user who saves it, the user can directly jump to the relevant content ). At this time, there is a problem. Before you jump to the content interface, login will appear first. (My judgment is in oncreate of loginview ). When the simulator is running, there is no such situation as 1.6 and 2.2.

In the end, there was no way to find a method that was made before the iPhone's view came out. Instead, I had to give up the method mentioned above and use another clever method:

That is, when lunchimage is placed in loginview, as long as an image overwrites the entire screen, it will be "lunch" (2 seconds after sleep, asynchronous classes will be used here, and the system will return to the main thread after 2 seconds of Asynchronization) then set the image attribute to gone.

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.