首先,我们可以先看一下“手相评分”这款软件的启动画面。如下:

其实,做欢迎界面的原理非常简单,就是在onCreate函数中启动一个线程,线程体在睡眠几秒钟之后,跳转
到MainActivity即可。具体实现代码如下:
WelcomeActivity.java

import android.app.Activity;import android.content.Intent;import android.os.Bundle;import android.os.Handler;import android.os.Message;import android.view.Window;import android.view.WindowManager;/* *@author: ZhengHaibo   *web:     http://blog.csdn.net/nuptboyzhb *mail:    zhb931706659@126.com *2013-3-25  Nanjing,njupt,China */public class WelcomeActivity extends Activity {private static final int GOTO_MAIN_ACTIVITY = 0;@Overridepublic void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);// 设置无标题requestWindowFeature(Window.FEATURE_NO_TITLE);// 设置全屏getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);setContentView(R.layout.activity_welcome);MyTimer timer = new MyTimer();timer.start();//启动线程}Handler mHandler = new Handler() {public void handleMessage(Message msg) {switch (msg.what) {case GOTO_MAIN_ACTIVITY:Intent intent = new Intent();intent.setClass(WelcomeActivity.this, SystemMain.class);startActivity(intent);finish();break;default:break;}};};public class MyTimer extends Thread {public MyTimer() {// TODO Auto-generated constructor stub}@Overridepublic void run() {// TODO Auto-generated method stubtry {Thread.sleep(3000);// 线程暂停时间,单位毫秒mHandler.sendEmptyMessage(GOTO_MAIN_ACTIVITY);} catch (InterruptedException e) {// TODO Auto-generated catch blocke.printStackTrace();}}}}



布局代码activity_welcome.xml

<?xml version="1.0" encoding="utf-8"?><LinearLayoutandroid:layout_width="fill_parent"android:layout_height="fill_parent"android:orientation="horizontal"android:background="@drawable/welcome"xmlns:android="http://schemas.android.com/apk/res/android"></LinearLayout>




对了,广告一下, 手相评分即是本人开发,多谢大家支持!以后会写该软件图像处理方面的实现方法,敬请期待!

更多相关文章

  1. 充电clientandroid电池(五):电池 充电IC(PM2301)驱动分析篇
  2. Android中的RxJava详解
  3. android部分介绍
  4. Android(安卓)Studio使用JDBC连接MySQL出现java.lang.Unsupporte
  5. Android简易聊天室软件(HTTP实现)
  6. RxJava漫谈-RxAndroid使用
  7. Android(安卓)Intent常见的FLAG
  8. android Looper类
  9. android周期性任务

随机推荐

  1. Android实现画虚线的控件
  2. android CTS SELinuxDomainTest# testIni
  3. android wegit 组件
  4. androidのview游戏框架
  5. 判断android devices是否联网
  6. Android学习之ListView使用基础
  7. 【Android】进程与线程基本知识
  8. android经典优化点
  9. Android(安卓)手机震动
  10. 两个界面的切换