parent
1dace172b7
commit
b58b1fb244
@ -0,0 +1,29 @@
|
||||
package com.example.doitnow; // 確保你的 package 名稱正確
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
public class SplashActivity extends AppCompatActivity {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_splash);
|
||||
|
||||
// 隱藏標題欄
|
||||
if (getSupportActionBar() != null) {
|
||||
getSupportActionBar().hide();
|
||||
}
|
||||
|
||||
// 1秒後跳轉到 MainActivity
|
||||
new Handler().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Intent i = new Intent(SplashActivity.this, MainActivity.class);
|
||||
startActivity(i);
|
||||
finish(); // 關閉當前活動,防止返回閃屏頁
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue