博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
andriod一个不错的启动菜单显示屏动画效果
阅读量:7236 次
发布时间:2019-06-29

本文共 1976 字,大约阅读时间需要 6 分钟。

看到一个老外做的不错的android启动菜单的动画效果,小结下。
1 首先在drawable目录下放一些动画要用的图片。
2 splash.xml:

3 点启动窗口动画效果后显示的main.xml

 

4 SplashScreen.java
这里是欢迎启动类的核心部分

 

public class SplashScreen extends Activity {    /**      * The thread to process splash screen events      */     private Thread mSplashThread;  /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) {     super.onCreate(savedInstanceState);    // Splash screen view     setContentView(R.layout.splash);             // Start animating the image     final ImageView splashImageView = (ImageView) findViewById(R.id.SplashImageView);     splashImageView.setBackgroundResource(R.drawable.flag);     final AnimationDrawable frameAnimation = (AnimationDrawable)splashImageView.getBackground();     splashImageView.post(new Runnable(){ public void run() {     frameAnimation.start();         }                 });     final SplashScreen sPlashScreen = this;           // The thread to wait for splash screen events     mSplashThread =  new Thread(){     @Override     public void run(){     try {     synchronized(this){     // Wait given period of time or exit on touch     wait(5000);     }     }     catch(InterruptedException ex){        }finish();         // Run next activity     Intent intent = new Intent();     intent.setClass(sPlashScreen, MainActivity.class);     startActivity(intent);     stop();          }     };      mSplashThread.start();     }@Override public boolean onCreateOptionsMenu(Menu menu){ super.onCreateOptionsMenu(menu); return false; }     /**      * Processes splash screen touch events      */     @Override     public boolean onTouchEvent(MotionEvent evt)     {     if(evt.getAction() == MotionEvent.ACTION_DOWN)     {     synchronized(mSplashThread){     mSplashThread.notifyAll();     }     }     return true;     } 4 为了更好看,在values 目录下添加样式文件 styles.xml: 
注意下这里

 

 

转载地址:http://tulfm.baihongyu.com/

你可能感兴趣的文章
No package mysql-server available.
查看>>
[ios]sqlite轻量级数据库学习连接
查看>>
东欧视频游戏市场概况
查看>>
它们的定义ListView,实现Item除去滑动和滑出菜单效果
查看>>
2015第我35周三
查看>>
Web前端研发工程师编程能力飞升之路
查看>>
C#编程总结(十)字符转码
查看>>
linux gcc头文件搜索路径
查看>>
对线程的理解
查看>>
更改linux swappiness 提高物理内存使用率
查看>>
J-Link GDB Server Command
查看>>
如何用.NET生成二维码?
查看>>
C++一个简单的手柄类模板
查看>>
The Water Problem(排序)
查看>>
atitit.无线上网卡 无法搜索WiFi 解决无线路由器信号不能被连接
查看>>
C#进阶系列——DDD领域驱动设计初探(三):仓储Repository(下)
查看>>
android 电容屏(三):驱动调试之驱动程序分析篇
查看>>
数字签名时间戳服务器的原理 !
查看>>
C++ Split string into vector<string> by space
查看>>
JavaScript学习——内置属性
查看>>