我是android开发的新手。
我使用 res/values 文件夹中的主题来显示启动画面:
<style name="Theme.Splash" parent="android:Theme">
<item name="android:windowBackground">@drawable/launch_screen</item>
<item name="android:windowNoTitle">true</item>
</style>
在 AndroidManifest 我有:
<activity
android:name="SplashScreen"
android:screenOrientation="portrait"
android:theme="@style/Theme.Splash" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
闪屏的活动代码是:
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; /* 3 seconds */
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);
}
}
在 res/drawable 文件夹中,我有文件 launch_screen.png (480 * 800 px)。
1) 我的尺寸适合大多数安卓设备吗?
2)我可能需要在其他文件夹中添加一些其他图像或样式文件吗?
先感谢您?