すべてが onCreate() メソッドで初期化されている間にスプラッシュ スクリーンを表示したいのですが、画面に何かを描画する必要があるコンポーネントも初期化されているため、アプリの起動時と onCreate() の後に黒い画面が表示されます。メソッドが完了すると、最初の画面のみが描画されます。黒い画面の代わりに、スプラッシュ スクリーンが必要です。
onCreate メソッドのコードは次のとおりです。
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Acquire a wakeLock to prevent the phone from sleeping
PowerManager powerManager = (PowerManager) getSystemService(Context.POWER_SERVICE);
wakeLock = powerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK, "GLGame");
// Setup all the Game Engine components
gameEngineLog = new WSLog("WSGameEngine");
gameEngineLog.setLogType(this.gameEngineLogType);
gameLog = new WSLog(this.gameLogTAG);
gameLog.setLogType(this.gameLogType);
io = new FileIO(this, getAssets());
audio = new Audio(this);
wsScreen = new WSScreen(this, this.screenResizeType, this.customTopYGap, this.customLeftXGap, this.gameScreenWidth, this.gameScreenHeight);
graphics = new Graphics(this, wsScreen.getGameScreen(), wsScreen.getGameScreenextended());
renderView = new RenderView(this, wsScreen.getGameScreen(), wsScreen.getGameScreenextended(), FPS, maxFrameskippes);
input = new Input(this, renderView, logGameEngineInputLog);
setContentView(renderView);
if(useOfAnalytics == true) {
getGameEngineLog().w(classTAG, "Analytics has been enabled");
analytics = new Analytics(this);
}
// Check that the developer has initialized the assets
if(this.assets == null) {
this.gameEngineLog.w(classTAG, "The assets for the game haven't been defined!");
}
}
最初に黒い画面が表示されないようにするには、スプラッシュ スクリーンをどのように実装すればよいですか?