本文介绍了在Android的飞溅不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图创建一个启动画面为我的Android应用程序,但它不会显示在所有。在code我使用的是4个不同的文件。在这里,它是:
I'm trying to create a splash screen for my app in android but it will not show up at all.The code i'm using is 4 different files. Here it is:
Splash.java
Splash.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
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);
}
}
Splash.xml
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中
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>
请告诉我,我在做什么错在这里。任何帮助将是AP preciated。感谢球员:)
Please tell me what I'm doing wrong here. Any help would be appreciated. Thanks guys:)
推荐答案
我觉得开机应该是发射活动的第一个
。并在声明 SPLASHNEW
在AndroidManifest文件?
i think Splash should be launcher activity first
. and where you declare SPLASHNEW
in AndroidManifest File ?.
这篇关于在Android的飞溅不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!