动画

引用:http://www.oschina.net/code/snippet_12_1259

[图片] shot.jpg

[代码] SplashScreen.java

01 public class SplashScreen extends Activity {
02      
03     /**
04      * The thread to process splash screen events
05      */
06     private Thread mSplashThread;   
07  
08     /** Called when the activity is first created. */
09     @Override
10     public void onCreate(Bundle savedInstanceState) {
11         super.onCreate(savedInstanceState);
12  
13         // Splash screen view
14         setContentView(R.layout.splash);
15          
16         final SplashScreen sPlashScreen = this;  
17          
18         // The thread to wait for splash screen events
19         mSplashThread =  new Thread(){
20             @Override
21             public void run(){
22                 try {
23                     synchronized(this){
24                         // Wait given period of time or exit on touch
25                         wait(5000);
26                     }
27                 }
28                 catch(InterruptedException ex){                   
29                 }
30  
31                 finish();
32                  
33                 // Run next activity
34                 Intent intent = new Intent();
35                 intent.setClass(sPlashScreen, MainActivity.class);
36                 startActivity(intent);
37                 stop();                   
38             }
39         };
40          
41         mSplashThread.start();
42          
43     }
44          
45     /**
46      * Processes splash screen touch events
47      */
48     @Override
49     public boolean onTouchEvent(MotionEvent evt)
50     {
51         if(evt.getAction() == MotionEvent.ACTION_DOWN)
52         {
53             synchronized(mSplashThread){
54                 mSplashThread.notifyAll();
55             }
56         }
57         return true;
58     }
59      
60 }

[文件] AdvancedSplashDemo.zip ~ 1MB    下载(410)

posted @ 2011-09-23 17:28  镇水古月  阅读(193)  评论(0编辑  收藏  举报