标志显示在应用程序启动几秒钟 [英] Displaying logo for few seconds at application start

查看:112
本文介绍了标志显示在应用程序启动几秒钟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想申请前开始显示几秒钟的标志和菜单是可见的。我还想用一些,当它消失。我应该创建一个新的活动?我可以将其设置在布局?

I want to display a logo for few seconds before application starts and menu is visible. I want also to use some when it disappears. Should I create a new activity? Can I set it in layout ?

推荐答案

定义开机画面的布局,将包含您的徽标,然后,添加此code至您的活动:

define a layout for the splash screen which will contain your logo , and then , add this code to your activity :

public void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    setContentView(R.layout.splash);
    //display the logo during 5 secondes,
    new CountDownTimer(5000,1000){
        @Override
        public void onTick(long millisUntilFinished){} 

        @Override
        public void onFinish(){
               //set the new Content of your activity
               YourActivity.this.setContentView(R.layout.main);
        }
   }.start();

}

这篇关于标志显示在应用程序启动几秒钟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆