標籤:android style blog http color os io 2014
接通過ImageView建立一個全屏的圖片:
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <ImageView android:layout_width="match_parent" android:layout_height="match_parent" android:src="@drawable/splash" android:scaleType="center" /></LinearLayout>
建立activity:
package com.example.testwelcome;import android.app.Activity;import android.content.Intent;import android.os.Bundle;import android.os.Handler;import android.widget.Toast;public class WelcomeActivity extends Activity{ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.welcome); new Handler().postDelayed(new Runnable(){ @Override public void run() { // TODO Auto-generated method stub Intent intent = new Intent(WelcomeActivity.this, MainActivity.class); startActivity(intent); WelcomeActivity.this.finish(); } }, 2000);//兩秒後跳轉到另一個頁面 }}
AndroidManifest.xml
設定預設啟動WelcomeActivity,並設定主題為全屏無標題樣式
<application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" > <activity android:name="com.example.testwelcome.WelcomeActivity" 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="com.example.testwelcome.MainActivity"></activity> </application>
>>執行個體下載