每次我的應用程序啓動時,都會在短時間內顯示白色背景。 儘管使用啓動畫面,問題仍然存在。 我想將默認啓動屏幕設置爲黑色而不是白色!Android應用程序啓動時的白色背景
這是我潑的屏幕活動:
public class SplashActivity extends Activity {
private static String TAG = SplashActivity.class.getName();
private static long SLEEP_TIME = 1; // Sleep for some time
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE); // Removes title bar
setContentView(R.layout.splash);
// Start timer and launch main activity
IntentLauncher launcher = new IntentLauncher();
launcher.start();
}
private class IntentLauncher extends Thread {
/**
* Sleep for some time and than start new activity.
*/
@Override
public void run() {
try {
// Sleeping
Thread.sleep(SLEEP_TIME*1000);
} catch (Exception e) {
Log.e(TAG, e.getMessage());
}
// Start main activity
Intent intent = new Intent(SplashActivity.this, MainActivity.class);
SplashActivity.this.startActivity(intent);
SplashActivity.this.finish();
}
}
@Override
protected void onPause() {
super.onPause();
overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
}
}
謝謝!那很好! – cxphong
非常好 - 謝謝! – gnB