在应用程序中经常用到启动画面,会启动一个后台线程为主程序的运行准备资源。
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. 利用BLCR加快Android的启动过程
  2. Activity中的四种启动模式
  3. Android开机log分析
  4. Android(安卓)back键ANR,与onPause,onDestory “延迟执行”的问题
  5. android 测试简介
  6. Android中关于startActivityForResult()在activity不同启动模式
  7. android启动过程
  8. android adb启动失败问题 adb server is out of date. killing..
  9. android:launchMode="singleTask" 与 onNewIntent(Intent intent

随机推荐

  1. 在Ubuntu中和Android中添加开机自启动的
  2. Android应用程序防止被LMK干掉
  3. 移动端兼容问题总结(1)
  4. 自己封装的Android(安卓)sqlite-helper.j
  5. mysql本地登录无法使用端口号登录的解决
  6. Windows7 64位安装最新版本MySQL服务器的
  7. 安装mysql8.0.11及修改root密码、连接nav
  8. mysql查询时offset过大影响性能的原因和
  9. MySQL优化insert性能的方法示例
  10. window系统mysql无法输入和无法显示中文