如何在Android首次活动加载之前删除白屏? [英] How to remove white screen before loading of first activity in android?

查看:129
本文介绍了如何在Android首次活动加载之前删除白屏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当我启动我的应用程序,一个白色的屏幕显示在其标题栏中的开始。我不希望看到此屏幕将出现在我的应用程序。我已阅读previous的问题,但答案并不清晰。

Whenever i launch my app, a white screen appears in the beginning with the title bar. I don't want this screen to be appear in my app. I have read previous questions, but answers are not clear to me.

我还使用闪屏,但在此之前出现白屏。

I'm also using splash screen, but white screen appears before that.

我不想换主题风格,因为它要么提高最低sdkVersion或改变的EditText,按钮,复选框等

I don't want to change the theme style, because it either increases the minimum sdkVersion or changes the style of edittext, buttons, checkboxes etc

请帮助我,使我出这一点。

Please help me to keep me out of this.

感谢您。

推荐答案

preface :对于这样的问题你应该张贴您的出发活动XML和的onCreate( )和相关方法。

Preface: For questions like this you should post your starting activities xml and the onCreate() and associated methods.

在开始的Andr​​oid应用程序,将通常使用黑色的观点,表明它正在推出,这是我改变白色选择你的主题/风格。如果你是正确加载的观点,那么你应该只看到这个空白的(黑色或白色),页50-200毫秒(我找不到这一权利的谷歌文档现在)。如果你是做了很多工作,你的的onCreate 方法,那么它会需要更长的时间。

When android starts your application it will typically use a black view to indicate that it is launching, this my change to white with your theme/style selected. If you are loading the view correctly then you should only see this blank (white or black) page for 50-200 ms (I can't find the google document for this right now). If you are doing a lot of work in your onCreate method then it will take longer.

通常情况下,使我的观点显示速度更快,我会简单地做大部分工作联系起来的它加载后。例如:

Typically to make my views display faster I will simply do the majority of the linking work after it has loaded. ex:

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

    //We use a handler so that the activity starts very fast
    new Handler().postDelayed(new Runnable() {
        @Override
        public void run() {
            delayedInit();
        }
    }, 100);
}

此外,移动应用程序通常不应有闪屏,除非他们需要一段时间来加载内容(如游戏,首次推出的文件等),不应该使用的只是的到品牌您的应用程序,或显示公司名称。

Additionally, mobile applications should typically not have a splash screen unless they take quite a while to load the contents (e.g. games, first time launch files, etc.) and should not be used just to brand your application, or display your company name.

更新(2015年7月31日)

谷歌应用程序正在朝着有闪屏的方向(见硬盘,Gmail等)

Google apps are now moving in the direction of having splash screens (see drive, GMail, etc.)

此外,你不应该做比在onCreate()方法去参考意见以外的任何工作。任何如检索从内存(数据库,preFS等)的信息长期运行的操作应以AsyncTaskLoader或AsyncTask的完成。

Additionally, You shouldn't be doing any work other than de-referencing views in the onCreate() method. Any long running operations such as retrieving information from memory (database, prefs, etc.) should be done in an AsyncTaskLoader or AsyncTask.

这篇关于如何在Android首次活动加载之前删除白屏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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