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.