安卓:闪屏问题 [英] Android: Splash screen problem

查看:137
本文介绍了安卓:闪屏问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用后续的code启动画面:

I created a splash screen using the follow code:

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    this.setContentView(R.layout.splash_layout);

    Thread splashThread = new Thread() {
        @Override
        public void run() {
            try {
                int waited = 0;
                while (_active && (waited < _splashTime)) {
                    sleep(100);
                    if (_active) {
                        waited += 100;
                    }
                }
            } catch (InterruptedException e) {
                // do nothing
            } finally {
                _active = false;
                finish();
                startActivity(new Intent(SplashActivity.this, MyMainActivity.class));
            }
        }
    };

    splashThread.start();
}

中有splash_layout图像视图,在启动画面出现一段持续时间后,消失然后MyMainActivity开始,问题是,飞溅消失后MyMainActivity开始之前,我可以看到previous屏幕(无关我的应用程序,例如桌面小部件,或previous运行的应用程序),如何使过渡流畅,使闪屏直接去MyMainActivity?

there is an image view in splash_layout, after the splash screen appears for some time duration, and disappears then MyMainActivity starts, the problem is, after the splash disappears and before MyMainActivity starts, I could see previous screen(irrelevant to my app, e.g. desktop with widgets, or previous running app), how to make the transition fluent so that splash screen directly goes to MyMainActivity?

谢谢!

推荐答案

作为参考,在这里是的 Android的 - 闪屏例子

For your reference, here is a best example for Android - Splash Screen example.

这篇关于安卓:闪屏问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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