可能重复:
Android 中的 Splash 无法正常工作
我的启动画面保持静止。它不会让主应用程序运行。这是我正在使用的代码:我有三个文件:Splash.xml、Splash.java 和 SplashNew.java
package com.timchecklist;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
public class Splash extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Thread Timer = new Thread() {
public void run() {
try {
sleep(3000);
startActivity(new Intent("com.timchecklist.SPLASHNEW"));
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
finish();
}
}
};
Timer.start();
}
}
SplashNew.java
package com.timchecklist;
import android.app.Activity;
import android.os.Bundle;
import android.view.Window;
public class SplashNew extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.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"
android:layout_gravity="center"
android:background="@drawable/pic1"
android:gravity="center"
android:orientation="vertical" >
</LinearLayout>
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.timchecklist"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="7" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:name=".TimCheckListActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar" >
</activity>
<activity
android:name=".SplashNew"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
任何想法/帮助?
伙计们