コードがスタック オーバーフローに投稿された Android アプリのスプラッシュ スクリーンのコードを使用しています。出力を取得できません。これがコードです。
package com.splash;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
public class SplashScreen extends Activity {
private static final int SPLASH_DISPLAY_TIME = 3000;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
new Handler().postDelayed(new Runnable() {
public void run() {
Intent mainIntent = new Intent(Splashscreen.this,
MainActivity.class);
Splashscreen.this.startActivity(mainIntent);
Splashscreen.this.finish();
overridePendingTransition(R.anim.mainfadein,
R.anim.splashfadeout);
}
}, SPLASH_DISPLAY_TIME);
}
}
}
これは、splash.xml ファイルです。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/splash" />
</LinearLayout>
解決方法を教えてください。また、スプラッシュ スクリーン イメージ用のフェードインおよびフェードアウト xml ファイルもあります。