我的问题是,如果我通过在清单中添加这一行将我的启动设置为 a Dialog
,则会有延迟:android:theme="@android:style/Theme.Holo.Dialog.NoActionBar"
启动屏幕消失后,主要活动大约需要 6 秒或更长时间才会出现。
我怎样才能让这种延迟消失?
启动代码:
public class SplashActivity extends Activity {
private final int DURATION = 3000;
private Thread mSplashThread;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
mSplashThread = new Thread() {
@Override
public void run() {
synchronized (this) {
try {
wait(DURATION);
} catch (InterruptedException e) {
} finally {
finish();
Intent intent = new Intent(getBaseContext(),
MainActivity.class);
startActivity(intent);
}
}
}
};
mSplashThread.start();
}
@Override
public boolean onTouchEvent(MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
synchronized (mSplashThread) {
mSplashThread.notify();
}
}
return true;
}
}