添加加载屏幕在Android应用程序启动 [英] Add the loading screen in starting of the android application

查看:177
本文介绍了添加加载屏幕在Android应用程序启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序加载在10秒的开始页面。在10秒的Andr​​oid屏幕,时间是空白的。 在那个时候我想补充的载入画面。如何添加呢? 并告诉我的应用程序如何知道起始页面加载?并告诉我怎么做我的应用程序?

My app is loading the start page in 10 seconds. In that time of 10 sec android screen is blank. In that time I want to add the loading screen. How to add it? And tell me in app how to know the starting page is loading? And tell me how to do in my app?

推荐答案

您可以使用闪屏像这样你的第一个装载活动:

You can use splash screen in your first loading Activity like this:

@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.splash);

        Thread welcomeThread = new Thread() {

            @Override
            public void run() {
                try {
                    super.run();
                    sleep(10000)  //Delay of 10 seconds
                } catch (Exception e) {

                } finally {

                    Intent i = new Intent(SplashActivity.this,
                            MainActivity.class);
                    startActivity(i);
                    finish();
                }
            }
        };
        welcomeThread.start();
    }

希望这有助于。

Hope this helps.

这篇关于添加加载屏幕在Android应用程序启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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