Android Splash Screen before black screen

喜欢而已 提交于 2019-12-01 09:01:45

Create a XML layout for this splash screen and set it as content view right after your super.onCreate():

super.onCreate(savedInstanceState);
setContentView (R.layout.splash_screen);

That should be enough. It would display this splash screen until your setContentView(renderView) is called.

//avoid time consuming work in UI thread but if that is related to UI itself then do as below

@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);


            setContentView(R.layout.first_splash_lauoy);

            new Handler().postDelayed(new Runnable() {

                public void run() {
                  //Your time consuming work 
                  //with spiiner(if needed) & setContentView(<finalView>)
                  }, 1000);
        }

    }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!