在应用程序中经常用到启动画面,会启动一个后台线程为主程序的运行准备资源。
Android要实现启动画面可以这样做:
这是splash.xml布局文件的代码[code]<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>[/code]

放一个ImageView加载启动画面图片
SplashActivity作为主视图启动/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
Handler x = new Handler();
x.postDelayed(new splashhandler(), 2000);

}
class splashhandler implements Runnable{

public void run() {
startActivity(new Intent(getApplication(),MainActivity.class));
SplashActivity.this.finish();
}

}

更多相关文章

  1. android init.rc详解
  2. android——wifi系统架构
  3. Android属性之build.prop,及property_get/property_set
  4. android am 启动activity service or broadcast及参数传递
  5. 简单android Service 创建与启动示例
  6. android system services startup process
  7. android开机自启动的后台Service的实现 .
  8. Android(安卓)启动 Launcher
  9. Android(安卓)Zygote分析

随机推荐

  1. “tns doctor” “You need to have the
  2. Android 折叠效果示例
  3. Android时间互换代码
  4. Annotation processors must be explicit
  5. Android 图片裁剪功能实现详解(类似QQ自定
  6. 【Android(安卓)开发】:TextView的几种使
  7. Anroid中的任务、进程和线程
  8. android 时间,日期对话框
  9. Android 隐藏类的使用
  10. android实现模拟加载中的效果