在我的 android 应用程序中,我使用了启动画面。但是在飞溅消失后,下一个屏幕在切换到主要活动之前变黑。但我不想要黑屏。谁能解释一下这里发生了什么以及如何防止黑屏?这是我的 SplashActivity 课程。
package my.easymedi.controller;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
public class SplashActivity extends Activity {
private static int SPLASH_TIME_OUT = 3000;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent i = new Intent(getApplicationContext(),
MainActivity.class);
startActivity(i);
}
}, SPLASH_TIME_OUT);
}
}
这是我的清单文件。
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="my.easymedi.controller"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<!-- Permissions -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<application
android:allowBackup="true"
android:icon="@drawable/easy_medi"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="my.easymedi.controller.SplashActivity"
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=".MainActivity" android:label="@string/app_name" android:screenOrientation="portrait"></activity>
</application>
我的日志猫是这样的:
10-22 11:19:59.699: E/Trace(1161): error opening trace file: No such file or directory (2)
10-22 11:19:59.699: W/Trace(1161): Unexpected value from nativeGetEnabledTags: 0
10-22 11:19:59.699: W/Trace(1161): Unexpected value from nativeGetEnabledTags: 0
10-22 11:19:59.699: W/Trace(1161): Unexpected value from nativeGetEnabledTags: 0
10-22 11:20:00.488: W/Trace(1161): Unexpected value from nativeGetEnabledTags: 0
10-22 11:20:00.488: W/Trace(1161): Unexpected value from nativeGetEnabledTags: 0
10-22 11:20:00.968: D/dalvikvm(1161): GC_FOR_ALLOC freed 123K, 9% free 2584K/2824K, paused 44ms, total 47ms
10-22 11:20:01.078: W/Trace(1161): Unexpected value from nativeGetEnabledTags: 0
10-22 11:20:01.078: W/Trace(1161): Unexpected value from nativeGetEnabledTags: 0
10-22 11:20:01.089: W/Trace(1161): Unexpected value from nativeGetEnabledTags: 0
10-22 11:20:01.108: W/Trace(1161): Unexpected value from nativeGetEnabledTags: 0
10-22 11:20:01.178: W/Trace(1161): Unexpected value from nativeGetEnabledTags: 0
10-22 11:20:01.178: W/Trace(1161): Unexpected value from nativeGetEnabledTags: 0
10-22 11:20:01.188: W/Trace(1161): Unexpected value from nativeGetEnabledTags: 0
10-22 11:20:01.279: W/Trace(1161): Unexpected value from nativeGetEnabledTags: 0
10-22 11:20:01.298: W/Trace(1161): Unexpected value from nativeGetEnabledTags: 0
10-22 11:20:01.298: W/Trace(1161): Unexpected value from nativeGetEnabledTags: 0
10-22 11:20:01.298: W/Trace(1161): Unexpected value from nativeGetEnabledTags: 0
10-22 11:20:01.298: W/Trace(1161): Unexpected value from nativeGetEnabledTags: 0
10-22 11:20:01.298: W/Trace(1161): Unexpected value from nativeGetEnabledTags: 0
10-22 11:20:01.328: D/gralloc_goldfish(1161): Emulator without GPU emulation detected.
10-22 11:20:01.389: W/Trace(1161): Unexpected value from nativeGetEnabledTags: 0
10-22 11:20:01.438: W/Trace(1161): Unexpected value from nativeGetEnabledTags: 0
10-22 11:20:04.138: W/Trace(1161): Unexpected value from nativeGetEnabledTags: 0
10-22 11:20:04.198: W/Trace(1161): Unexpected value from nativeGetEnabledTags: 0
10-22 11:20:04.198: W/Trace(1161): Unexpected value from nativeGetEnabledTags: 0
10-22 11:20:04.758: D/dalvikvm(1161): GC_CONCURRENT freed 25K, 6% free 2954K/3116K, paused 73ms+14ms, total 177ms
10-22 11:20:04.758: D/dalvikvm(1161): WAIT_FOR_CONCURRENT_GC blocked 65ms
10-22 11:20:04.878: I/System.out(1161): ===false===
10-22 11:20:05.078: I/System.out(1161): ***copy db***