在应用程序中经常用到启动画面,会启动一个后台线程为主程序的运行准备资源。
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作为主视图启动[code]/** 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();
}

}[/code]

更多相关文章

  1. Android基础系列-----------Android进程/线程管理应用示例(Androi
  2. Android 线程归纳
  3. Android多线程(一)
  4. android 电池(二):android关机充电流程、充电画面显示
  5. Android异步处理一:使用Thread+Handler实现非UI线程更新UI界面 .

随机推荐

  1. Android(安卓)AIDL使用详解
  2. Android(安卓)Platform 3.0 SDK和Eclipse
  3. android
  4. 关于Android设备屏幕大小及密度的系统参
  5. Android:简易弹幕效果实现,android弹幕
  6. Android成长(二)——两个页面交互
  7. Android开发小技巧之------------如何不
  8. android开发学习笔记(1)我的第一个android
  9. 在android使用OPENGL总结
  10. Timed out Device -- Vibrator