当我在没有线程代码的情况下运行启动画面时,会出现启动画面背景,但是当我通过线程启动背景图像时,不会显示启动画面。
我的splash.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/splash"
>
</LinearLayout>
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="travis.com"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8" />
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".Splash"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".TheNewBostonActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="com.thenewboston.travis.STARTINGPOINT" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
飞溅.java:
package travis.com;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
public class Splash extends Activity {
@Override
protected void onCreate(Bundle TravisLoveBeacon) {
// TODO Auto-generated method stub
super.onCreate(TravisLoveBeacon);
setContentView(travis.com.R.layout.splash);
Thread timer = new Thread() {
public void run() {
try {
sleep(5000);
}
catch(InterruptedException e) {
e.printStackTrace();
}
finally {
Intent openstatingpoint = new Intent("com.thenewboston.travis.STARTINGPOINT");
startActivity(openstatingpoint);
}
}
};
timer.run();
}
}