You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
920 B
30 lines
920 B
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);
|
|
}
|
|
}
|