zoukankan      html  css  js  c++  java
  • 动画

    引用: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)

  • 相关阅读:
    依赖注入
    微服务下的安全方案
    VS2019 社区版(community) 离线版本 解决“试用30天过期”步骤
    webpack4升级webpack5
    Ubuntu 上 Node.js 安装和卸载
    记录一次使用locust压测的过程
    大厂面试通关指南,已拿腾讯,阿里offer(附100+最新大厂真题)
    通过自己整理和刷题三个月成功入职腾讯,皇天不负有心人啊!!
    不懂就问系列,为什么别人能靠这份面试题宝典去大厂?(内附面试题答案)
    整理了3家面试问题:美团+字节+腾讯,个个三面,你认为你能走到哪一面?
  • 原文地址:https://www.cnblogs.com/sode/p/2186480.html
Copyright © 2011-2022 走看看