您好,登錄后才能下訂單哦!
LoginActivity package com.xkhouse.erm.erm; import android.app.Activity; import android.os.Bundle; import android.view.Window; /* public class LoginActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { //requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); } } */ public class LoginActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); /* * 設(shè)置隱藏標(biāo)題欄 */ requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.activity_login); } } /* public class SplashActivity extends Activity { private final int SPLASH_DISPLAY_LENGHT = 1000; //延遲一秒 @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.jiazai); new Handler().postDelayed(new Runnable() { // 為了減少代碼使用匿名Handler創(chuàng)建一個(gè)延時(shí)的調(diào)用 public void run() { Intent i = new Intent(SplashActivity.this, LoginActivity.class); // 通過Intent打開最終真正的主界面Main這個(gè)Activity SplashActivity.this.startActivity(i); // 啟動(dòng)Main界面 SplashActivity.this.finish(); // 關(guān)閉自己這個(gè)開場屏 } }, SPLASH_DISPLAY_LENGHT); } } */ SplashActivity package com.xkhouse.erm.erm; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.view.Window; import android.view.WindowManager; /*public class SplashActivity extends Activity { private final int SPLASH_DISPLAY_LENGHT = 6000; // 延遲六秒 @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.splash); new Handler().postDelayed(new Runnable() { public void run() { Intent mainIntent = new Intent(SplashActivity.this, LoginActivity.class); SplashActivity.this.startActivity(mainIntent); SplashActivity.this.finish(); } }, SPLASH_DISPLAY_LENGHT); } } */ public class SplashActivity extends Activity { final private int SPLASH_TIME = 1000; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); /* * 設(shè)置全屏 */ getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); /* * 設(shè)置隱藏標(biāo)題欄 */ requestWindowFeature(Window.FEATURE_NO_TITLE); /* * 2秒后跳轉(zhuǎn)到主界面 */ new Handler().postDelayed(new Runnable() { public void run() { launchMainActivity(); } }, SPLASH_TIME); setContentView(R.layout.activity_splash); } /* * 利用Intent切換到主Activity */ private void launchMainActivity() { /* * 創(chuàng)建一個(gè)intent,從當(dāng)前Activity指向要跳轉(zhuǎn)的Activity */ Intent intent = new Intent(this, LoginActivity.class); /* * 啟動(dòng)目標(biāo)Activity */ startActivity(intent); /* * 啟動(dòng)畫面只需要程序開始時(shí)顯示一次,顯示完后即可退出 */ finish(); } } layout目錄下 activity_splash.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="fill_parent" android:layout_width="fill_parent" android:orientation="vertical"> <ImageView android:layout_height="fill_parent" android:layout_width="fill_parent" android:scaleType="fitCenter" android:src="@drawable/splash"></ImageView> </LinearLayout> AndroidMainfest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.xkhouse.erm.erm"> <application android:allowBackup="true" android:icon="@drawable/logo" android:label="@string/app_name" android:theme="@android:style/Theme.NoTitleBar.Fullscreen"> <activity android:name="com.xkhouse.erm.erm.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=".LoginActivity"></activity> </application> </manifest>
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。