Android 应用程序启动时黑屏几秒钟(没有可用的半透明主题)

Blank Screen for few secs on app launch on Android (No translucent theme avalaible)

我想摆脱应用程序启动后几秒钟显示的空白屏幕,但到目前为止我只找到了 "Translucent Theme Solution"。但我无法将此解决方案应用于我的应用程序,因为启动器 activity 是一个日志启动器,并且我希望能够通过按钮 "disconnect" 返回到它,而无需半透明主题。 有什么办法吗? 非常感谢!

试试这个

public class SplashScreen extends Activity {

// Splash screen timer
private static int SPLASH_TIME_OUT = 3000;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_splash);

    getSupportActionBar().hide();

    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);


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

        /*
         * Showing splash screen with a timer. This will be useful when you
         * want to show case your app logo / company
         */

        @Override
        public void run() {
            // This method will be executed once the timer is over
            // Start your app main activity
            Intent i = new Intent(SplashScreen.this, MainActivity.class);
            startActivity(i);

            // close this activity
            finish();
        }
    }, SPLASH_TIME_OUT);
}
}

更多信息请follow this link