发布于 2016-04-09 04:18:52 | 381 次阅读 | 评论: 0 | 来源: 网友投递
Android移动端操作系统
Android是一种基于Linux的自由及开放源代码的操作系统,主要使用于移动设备,如智能手机和平板电脑,由Google公司和开放手机联盟领导及开发。尚未有统一中文名称,中国大陆地区较多人使用“安卓”或“安致”。
<activity android:name=".SplashActivity"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:noHistory="true"
android:configChanges="orientation|keyboardHidden"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
public class SplashActivity extends Activity {
private Handler mMainHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setClass(getApplication(), NotTomorrowActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
// overridePendingTransition must be called AFTER finish() or startActivity, or it won't work.
overridePendingTransition(R.anim.activity_in, R.anim.splash_out);
}
};
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
getWindow().setBackgroundDrawableResource(R.drawable.kg);
mMainHandler.sendEmptyMessageDelayed(0, 5000);
}
// much easier to handle key events
@Override
public void onBackPressed() {
}
}
<?xml version="1.0" encoding="utf-8"?>
<ViewSwitcher xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/view_container"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:inAnimation="@anim/activity_in"
android:outAnimation="@anim/splash_out">
<ImageView android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/kg"
android:scaleType="fitXY"/>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TextView android:id="@+id/header"
style="@style/header_text" />
<TextView android:id="@+id/header_tip"
style="@style/task_text" />
<ListView android:id="@+id/task_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:footerDividersEnabled="true"
android:background="@color/white"/>
</LinearLayout>
</ViewSwitcher>
public class NotTomorrowActivity extends Activity {
protected static final String TAG = "NoTomorrowActivity";
protected static final int MSG_SHOW_LAYOUT = 10;
private static final int MENU_ADD_TASK = 0;
private Handler mMainHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case MSG_SHOW_LAYOUT:
final ViewSwitcher container = (ViewSwitcher) findViewById(R.id.view_container);
container.showNext();
ImageView view = (ImageView) container.getChildAt(0);
view.setImageResource(0);
container.removeViewAt(0);
mSplashing = false;
break;
default:
break;
}
}
};
private boolean mSplashing;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mSplashing = true;
setContentView(R.layout.not_tomorrow_activity);
mMainHandler.sendEmptyMessageDelayed(MSG_SHOW_LAYOUT, 5000);
}
@Override
public void onBackPressed() {
if (!mSplashing) {
super.onBackPressed();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
if (mSplashing) {
return false;
}
menu.add(0, MENU_ADD_TASK, 0, R.string.add_hint);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
if (mSplashing) {
return false;
}
return super.onPrepareOptionsMenu(menu);
}
}